[wheybags][for 0.17][0.16.28] Japanese (CJK?) text is slightly off center [...]

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

[wheybags][for 0.17][0.16.28] Japanese (CJK?) text is slightly off center [...]

Post by eradicator »

Japanese/Chinese text is slightly off center (too high) throughout the game, i.e. on all GUI elements and on flying-text, if the game is started with a non-CJK locale (i tested English and German). I've included some english text in the examples to make the effect more obvious, but it still happens with only CJK text.
off_center.jpg
off_center.jpg (19.93 KiB) Viewed 1559 times
However when using a CJK locale (tested with Japanese) it works fine:
oncenter.jpg
oncenter.jpg (9.2 KiB) Viewed 1559 times

Code: Select all

/sudo my.gui.center.add{type='button',caption='English 秋葉原 Home'} my.gui.center.add{type='label',caption='English 秋葉原 Home'}
This is so minor that i put off reporting it for a long time. But the slight cringes i get every time i see it finally brought me here ;). And i'm still not sure if reporting these tiny minor things causes more trouble than it it worth :/. Advice appreciated :P.

Jos
Inserter
Inserter
Posts: 30
Joined: Mon Jun 16, 2014 5:07 am
Contact:

Re: [0.16.28] Japanese (CJK?) text is slightly off center [...]

Post by Jos »

Each language has different fallbacks which indicates the sequence of the fonts used in game.
You can find them at /factorio/data/core/locale/.../info.json

Therefore, different starting locale has different default CJK font.

For now, the default CJK font for most of languages is only for zh-CN, which causes your problem.

Maybe using a global font as the default CJK font is the best choice.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [0.16.28] Japanese (CJK?) text is slightly off center [...]

Post by eradicator »

Huh. Interesting. Considering that and reexamining my screenshots i can clearly see that on Japanese locale both the English and the Japanese text use fonts different from the ones uesd in the English locale. Judging from the info.json English uses zh-CN/fonts/default-font.ttf, while Japanese uses /ja/fonts/regular.ttf for CJK.

OK, did some more testing and the issue seems to be that the chinese font has a different offset:

Code: Select all

/c game.player.gui.center.add{type='button',caption='English 秋葉原 Home'} game.player.gui.center.add{type='label',caption='English 働中動话話劍橋ひらがなカタカナ Home'}
language_rendering.png
language_rendering.png (129.56 KiB) Viewed 1523 times
The screenshot shows the output of the above command using the three respective game locale settings. You can see a few interesting things there.

The Chinese (zh-CN rendering is the only one that looks entirely correct. Which suggestes that it also includes Japanese characters and does not need to fall back to the actual japanese font.

The Japanese rendering has English and Japanese characters equally rendered, but you can clearly see how the two chinese characters are shifted upwards. This suggests they're not part of the Japanese font and thus need to fall back to the chinese font.

The English rendering uses the Chinese font as a fallback so all non-english characters are shifted equally upwards. The English one is also the only one that renders the font with "sharp" edges, while the two other fonts are softened.

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.16.28] Japanese (CJK?) text is slightly off center [...]

Post by posila »

Thanks for the detailed report.
We will revisit font rendering as part of rendering framework rewrite. I think Allegro font renderer doesn't treat some properties of the font correctly.
As far as I know, the default English font is the one we want to use for Factorio, unfortunatelly it contains only characters that are derived from latin alphabet.

Post Reply

Return to “Resolved Problems and Bugs”