Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text rendering error under CJK system locale #7511

Closed
YJSoft opened this issue Apr 14, 2019 · 9 comments · Fixed by #7572
Closed

Text rendering error under CJK system locale #7511

YJSoft opened this issue Apr 14, 2019 · 9 comments · Fixed by #7572
Labels
OS: Windows This issue is related to a MS Windows problem regression It used to work, and now it's broken.

Comments

@YJSoft
Copy link

YJSoft commented Apr 14, 2019

Version of OpenTTD

All version above 1.9.0-beta1

Expected result

(Windows 10 RS5)
image

Actual result

(Win7)
image

(Win8.1)
image

(Did't tested Win10 RTM ~ RS1 due to not supported by MS anymore)

(Win10 RS2)
image

(Win10 RS3)
image

(Win10 RS4)
image

Steps to reproduce

Execute OpenTTD 1.9.1 on Korean version of Windows(below Win10 RS5)
All strings are corrupted, even english.lng is not displayed correctly.
OpenTTD 1.8.0 works well, but OpenTTD 1.9.0-beta1 or above doesn't works.

@nielsmh
Copy link
Contributor

nielsmh commented Apr 14, 2019

Looks like this is #7477, thanks for the detailed report.

@nielsmh nielsmh added regression It used to work, and now it's broken. OS: Windows This issue is related to a MS Windows problem labels Apr 14, 2019
@telk5093
Copy link
Contributor

Notes:

  1. There is a one Win 8.1 user and it is fine for him
  2. A similar issue was at JGRPP(Languages are broken JGRennison/OpenTTD-patches#58)

@nielsmh
Copy link
Contributor

nielsmh commented Apr 18, 2019

It may have to do with having an MBCS ANSI locale set since (so far) only users with Chinese or Korean languages have reported this. I'm still on 1803 so I should try switching my ANSI locale and see if that affects language file loading.

@YJSoft YJSoft changed the title Strings not loaded correctly on CJK Windows version below RS5 Loading font from game folder not works at some windows version Apr 28, 2019
@YJSoft
Copy link
Author

YJSoft commented Apr 28, 2019

All systems above used config file from Here, which bundles NanumGothic font file. By default, config file will set OpenTTD font to ./font/NanumGothic.ttf and that is causing problem.

vmware_8SBEDD75fV
(Batang)

vmware_UGZ0VuSp6e
(NanumGothic font installed)
If I change font to Batang(which is one of default korean font) or install NanumGothic.ttf, everything works fine.

I tried to debug that, but vs debug build simply refuses to load ttf file.

@YJSoft YJSoft changed the title Loading font from game folder not works at some windows version Loading font from game folder not works Apr 29, 2019
@michicc
Copy link
Member

michicc commented May 4, 2019

If I change font to Batang(which is one of default korean font) or install NanumGothic.ttf, everything works fine.

OpenTTD switch to Microsoft's Uniscribe for text layout with the 1.9 release, as the layout component of the previously used ICU library is deprecated and has random crashes.

Font rendering is still done using FreeType and not GDI. FreeType will happily try to eat any font it is given, but Uniscribe, being a system components, relies on data provided by Windows, and seems to fail on uninstalled fonts. #6980 would fix that dissonance, but I'd assume Windows would automatically still select an installed font and not the one you want.

@nielsmh
Copy link
Contributor

nielsmh commented May 4, 2019

Running the game under a Chinese locale with https://github.com/xupefei/Locale-Emulator reproduces this bug, so we have something to work with now.

@nielsmh nielsmh changed the title Loading font from game folder not works Language file loading breaks under CJK system locale May 4, 2019
@nielsmh nielsmh changed the title Language file loading breaks under CJK system locale Text rendering error under CJK system locale May 4, 2019
@nielsmh
Copy link
Contributor

nielsmh commented May 4, 2019

It turns out the language data is being loaded correctly, and conversions from internal UTF-8 to the UTF-16 required by Uniscribe is correct. The problem seems to be somewhere in the shaping process, and it seems that it's (somehow) adding 3 to the value of each glyph number, or something similar to that.

@clzls
Copy link
Member

clzls commented Oct 11, 2019

Although it was marked as Fixed as early as 14 May, but the problem seems to remain in 1.9.3, and my openttd-20190824-master-gc7c1d1cb0c-windows-win64 worked fine...

@LordAro
Copy link
Member

LordAro commented Oct 11, 2019

Yes, it missed the 1.9 branch, and due to the significance of the fix (completely swapping out the text rendering engine) it couldn't be backported. It will be in the 1.10 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS: Windows This issue is related to a MS Windows problem regression It used to work, and now it's broken.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants