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

[Bug]: font (A-OTF Shin Go Pr6N) not working #11054

Closed
BPplays opened this issue Jun 21, 2023 · 8 comments
Closed

[Bug]: font (A-OTF Shin Go Pr6N) not working #11054

BPplays opened this issue Jun 21, 2023 · 8 comments

Comments

@BPplays
Copy link

BPplays commented Jun 21, 2023

Version of OpenTTD

1.13.3, windows 10

Expected result

the font to work

Actual result

some fonts do not work. trying to use A-OTF Shin Go Pr6N doesn't work but using MS Gothic it does work. when using A-OTF Shin Go Pr6N it seems to be using a fallback but not telling me, putting in random keyboard smashing to the font options results in no difference to the font

my openttd.cfg:

small_font = A-OTF Shin Go Pr6N
medium_font = A-OTF Shin Go Pr6N
large_font = A-OTF Shin Go Pr6N
mono_font = A-OTF Shin Go Pr6N
small_size = 12
medium_size = 14
large_size = 18
mono_size = 14
small_aa = true
medium_aa = true
large_aa = true
mono_aa = true

when using A-OTF Shin Go Pr6N and trying to read readme with japanese text (likely just the fallback font not supporting the characters):
0x3072 is ひ

Unknown debug level 'freetype=1'
dbg: [sprite] 1244 extra sprites, 1244 from baseset, 0 from fallback
dbg: [sprite] 1244 extra sprites, 1244 from baseset, 0 from fallback
dbg: [sprite] 1244 extra sprites, 1244 from baseset, 0 from fallback
dbg: [fontcache] Font is missing glyphs to display char 0x3072 in mono font size
dbg: [fontcache] Font is missing glyphs to display char 0x3072 in mono font size
dbg: [fontcache] Font is missing glyphs to display char 0x3072 in mono font size
dbg: [fontcache] Font is missing glyphs to display char 0x3072 in mono font size

Steps to reproduce

use A-OTF Shin Go Pr6N or seemingly any other type of shin go font, or probably other fonts too

@krysclarke
Copy link
Contributor

Does that font have a character at code point 0x3072?
If so, it's an issue with OTTD.
If there's no glyph, which is what the error message is saying, then it's NOT an OTTD issue (unless the Japanese translation of the readme text is wrong, but that's another matter).

@BPplays
Copy link
Author

BPplays commented Jun 21, 2023

it does 0x3072 is ひ (hi) a hiragana character, this font is japanese so it has the character, it seems to be using a fallback font.

my language is set to english and it dosnt give me any dbg: [fontcache] Font is missing glyphs to display char error but still seems to be using a fallback.

i made i python script to check all the characters in the langfiles i got here from github and it says there are no missing characters in the whole english us langfile

ive tried setting the font with the console it seems to be saying the font is set the arial after i do which i assume is the fallback

also the font is otf idk if that matters

@glx22
Copy link
Contributor

glx22 commented Jun 22, 2023

mono font is used for text files, so the check is done on file content itself.
You can get more details using -d fontcache=1

@BPplays
Copy link
Author

BPplays commented Jun 22, 2023

here is my log, but i think its just using the fallback font, this is my whole log,

what im confused about is that its giving me no error about missing glyphs when starting the game but still wont use the font and only seems to error cus the fallback font dosnt support kana when reading a readme with japanese text.
also using a mod with japanese city names only shows '?' but using meiryo works

dbg: [sprite] 1244 extra sprites, 1244 from baseset, 0 from fallback
dbg: [sprite] 1244 extra sprites, 1244 from baseset, 0 from fallback
dbg: [sprite] 1244 extra sprites, 1244 from baseset, 0 from fallback
dbg: [fontcache] Font is missing glyphs to display char 0x3072 in mono font size
dbg: [fontcache] Trying fallback fonts
dbg: [fontcache] Font is missing glyphs to display char 0x3072 in mono font size
dbg: [fontcache] Font is missing glyphs to display char 0x3072 in mono font size
dbg: [fontcache] Font is missing glyphs to display char 0x3072 in mono font size
dbg: [fontcache] Fallback font: MS Gothic (MS Gothic)

@PeterN
Copy link
Member

PeterN commented Jun 22, 2023

This particular font isn't freely available, so it's not something we test with.

@BPplays
Copy link
Author

BPplays commented Jun 22, 2023

ive tried with this font and it still seems to be doing the same thing.
but some fonts like meiryo work correctly but neither that font nor A-OTF Shin Go Pr6N do dispite not giving any errors on startup with the launch options -dsprite=1 -d fontcache=1

.
Screenshot 2023-06-22 062429

Screenshot 2023-06-22 062506

@PeterN
Copy link
Member

PeterN commented Jun 22, 2023

That font isn't freely available either. It may be zero cost, but it requires a login to obtain.

This is a known-issue though, if the chosen font doesn't have every single required character, the game prefers to use only the fallback font -- which may also not have every character, but by then it doesn't then 'fallback' to the chosen font.

@BPplays
Copy link
Author

BPplays commented Jun 22, 2023

the confusion im having is why it goes to fallback cus it dosnt say in the logs that there are any missing characters, i made a python script to check the whole langfile and it found nothing that didnt match

if i try a language setting that the font dosnt have all the characters it does say an error about it when i start the game, but using english it says nothing but still uses a fallback anyway
my script also catchs missing characters in other langfiles but none for english

PeterN added a commit to PeterN/OpenTTD that referenced this issue Jun 22, 2023
Most languages stick with the 3-letter latin currency codes in the name
string, however some translations are... clever... and use the currency
symbol instead. Whilst this may look nice, it can cause issues with fonts
as some scripts have a specific limited set of fonts which do not include
these symbols.

Instead, hard code the currency code list and add it when drawing the
currency name.
PeterN added a commit to PeterN/OpenTTD that referenced this issue Jun 22, 2023
Most languages stick with the 3-letter latin currency codes in the name
string, however some translations are... clever... and use the currency
symbol instead. Whilst this may look nice, it can cause issues with fonts
as some scripts have a specific limited set of fonts which do not include
these symbols.

Instead, hard code the currency code list and add it when drawing the
currency name.
PeterN added a commit to PeterN/OpenTTD that referenced this issue Jun 23, 2023
Most languages stick with the 3-letter latin currency codes in the name
string, however some translations are... clever... and use the currency
symbol instead. Whilst this may look nice, it can cause issues with fonts
as some scripts have a specific limited set of fonts which do not include
these symbols.

Instead, hard code the currency code list and add it when drawing the
currency name.
PeterN added a commit to PeterN/OpenTTD that referenced this issue Jun 23, 2023
Most languages stick with the 3-letter latin currency codes in the name
string, however some translations are... clever... and use the currency
symbol instead. Whilst this may look nice, it can cause issues with fonts
as some scripts have a specific limited set of fonts which do not include
these symbols.

Instead, hard code the currency code list and add it when drawing the
currency name.
PeterN added a commit to PeterN/OpenTTD that referenced this issue Jun 23, 2023
Most languages stick with the 3-letter latin currency codes in the name
string, however some translations are... clever... and use the currency
symbol instead. Whilst this may look nice, it can cause issues with fonts
as some scripts have a specific limited set of fonts which do not include
these symbols.

Instead, hard code the currency code list and add it when drawing the
currency name.
@PeterN PeterN closed this as completed in 9dd9b8e Jun 23, 2023
mrmbernardi pushed a commit to mrmbernardi/OpenTTD that referenced this issue Jul 2, 2023
Most languages stick with the 3-letter latin currency codes in the name
string, however some translations are... clever... and use the currency
symbol instead. Whilst this may look nice, it can cause issues with fonts
as some scripts have a specific limited set of fonts which do not include
these symbols.

Instead, hard code the currency code list and add it when drawing the
currency name.
shoter pushed a commit to shoter/OpenTTD that referenced this issue Jul 16, 2023
Most languages stick with the 3-letter latin currency codes in the name
string, however some translations are... clever... and use the currency
symbol instead. Whilst this may look nice, it can cause issues with fonts
as some scripts have a specific limited set of fonts which do not include
these symbols.

Instead, hard code the currency code list and add it when drawing the
currency name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants