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

The current fonts missing some of the characters used in the texts for this language #8988

Closed
Limyx826 opened this issue Apr 10, 2021 · 16 comments
Labels
needs triage This issue needs further investigation before it becomes actionable

Comments

@Limyx826
Copy link
Contributor

Limyx826 commented Apr 10, 2021

Version of OpenTTD

OpenTTD 1.11.0

Issue encountered

When I started up the game, this message is shown:

The current fonts missing some of the characters used in the texts for this language. Using system fallback font instead.

Here's the [misc] section in the config with my configured fonts:

[misc]
display_opt = SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION|FULL_DETAIL|WAYPOINTS|SHOW_COMPETITOR_SIGNS
fullscreen = false
support8bpp = no
graphicsset = "OpenGFX"
soundsset = "AltSFX"
musicset = "Touhou 2 MIDI"
videodriver = 
musicdriver = "win32:port=2"
sounddriver = 
blitter = 
language = english.lng
resolution = 1920,1001
screenshot_format = 
savegame_format = 
rightclick_emulate = false
small_font = Arial
medium_font = Tahoma Bold
large_font = Arial
mono_font = Courier New
small_size = 11
medium_size = 12
large_size = 20
mono_size = 12
small_aa = false
medium_aa = false
large_aa = false
mono_aa = false
sprite_cache_size_px = 128
player_face = 1181436432
transparency_options = 6
transparency_locks = 0
invisibility_options = 0
keyboard = 
keyboard_caps = 
last_newgrf_count = 59
gui_zoom = 2
font_zoom = 2
video_hw_accel = true

PS: on a side note after updating my OpenTTD from 1.10.3 to 1.11.0, the OpenMSX and OpenSFX is gone from the list.
For what reason I had no idea but it is no big deal as usual they can download from BaNaNaS.
Also the sound set and music set from the original TTD also gone.

@LordAro
Copy link
Member

LordAro commented Apr 10, 2021

Which language are you using? I'd be surprised if it were the English language, as you'd be hard pressed to find a font that doesn't support it!

Assuming that's the case, the config file listed above is not the one that's currently being used. The behaviour for reading config & content directories was tweaked slightly in 1.11, see https://github.com/OpenTTD/OpenTTD/blob/master/docs/directory_structure.md for more details about where to look for the active config file. You can also use -dmisc=4 commandline flag to get (a lot of) extra output about where OTTD is searching.

This is probably the reason why some sound/music sets have disappeared for you as well - they're in directories that are no longer being searched.

@Limyx826
Copy link
Contributor Author

Limyx826 commented Apr 10, 2021

Well I'm using English, that is also what suprise me as prior to 1.11 with the same config there are no issue at all even with 1.11-RC1. I not sure what change for 1.11 release but something must have been gone wrong.

@TrueBrain
Copy link
Member

Would you be able to start the game with a debug window open? Via powershell, navigate to the folder OpenTTD is installed in, and run:

openttd -dsprite=1 -dfreetype=1

And can you tell us what the black window also opening next to OpenTTD is telling you? Specifically, it should tell the exact character it is missing. That would greatly help us, tnx :)

@TrueBrain TrueBrain added the needs triage This issue needs further investigation before it becomes actionable label Apr 10, 2021
@Limyx826
Copy link
Contributor Author

image
image

Here's screenshot of both windows, text in the terminal shown as:

dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [sprite] 1263 extra sprites, 1263 from baseset, 0 from fallback
dbg: [sprite] 1263 extra sprites, 1263 from baseset, 0 from fallback
dbg: [freetype] Font is missing glyphs to display char 0x5C in medium font size
dbg: [freetype] Trying fallback fonts
dbg: [freetype] Fallback font: Arial (Arial)
dbg: [freetype] Font is missing glyphs to display char 0x5C in medium font size
dbg: [freetype] Trying fallback fonts
dbg: [freetype] Fallback font: Arial (Arial)
dbg: [sprite] 1263 extra sprites, 1263 from baseset, 0 from fallback
dbg: [freetype] Font is missing glyphs to display char 0x5C in medium font size
dbg: [freetype] Trying fallback fonts
dbg: [freetype] Fallback font: Arial (Arial)

@Limyx826
Copy link
Contributor Author

Limyx826 commented Apr 10, 2021

Lookup in the search seem like 0x5C is the backslash character, might have something to do with the system locale as my system locale is Japanese.

@TrueBrain
Copy link
Member

Thank you very much!

What is a bit odd to me, that we don't have any string with a \ in it that we didn't have before :P So I wonder what is causing that .. but at least this gives some clues where to look. Tnx!

@TrueBrain
Copy link
Member

I tried to reproduce this issue on my own system, so I could debug the problem. But when I use that exact same openttd.cfg, it doesn't error out for me.

There are two things weird to me:

  1. nothing changes in the use of \ between 1.11.0-RC1 and 1.11.0.
  2. why would a default font not have \ in its set for your system, while it does work for my system.

I am not sure how to proceed. Hopefully another dev has an idea :)

@Limyx826
Copy link
Contributor Author

I am wrong about that 1.11.0-RC1 had no such issue, cause I redownload that version and found out that it too have this problem.
Out of the version I redownload, seem like the issue had started all the way from 1.11.0-beta1 and none at all for 1.10.3. I might have been ignore that message when I test 1.11.0.

@Limyx826
Copy link
Contributor Author

Limyx826 commented Apr 10, 2021

c6fd6cf

@TrueBrain
Copy link
Member

Ah, yes, of course! The error was always hiding, but still there. We now only tell that the font is bad, instead of silently falling back to another :D How could I have forgotten about that.

So that brings us to the core issue .. the font doesn't know how to render \ which is really odd :(

@Limyx826
Copy link
Contributor Author

Limyx826 commented Apr 10, 2021

Just manage to trace down the change in between 1.10.3 and 1.11.0-beta1. If the debug message is correct then which string is the faulty one?

Also the locale maybe to be blame, as stated my system locale is set to Japanese, Shift JIS which is by default will render the character 0x5C as "¥" instead of the regular character "\". In which most English font are unable to render the "¥" character.

@TrueBrain
Copy link
Member

So that might be the core of this issue.

If I remember correctly, 1.10 already failed to load the font you selected (but didn't tell you about it). You can see this if you start 1.10.3 with -dsprite=1 -dfreetype=1. It properly also says it is falling back to Arial in your case.

If that is correct, it means that 1.11 tells you about this happening.

There is not much we can do about this. We validate fonts to contain all the letters we expect them to, and if they do not, it means it cannot render all our strings. So we find the next best font that can. As it most likely already was falling back to Arial for you, properly the best solution is to change that in your configuration file too.

But this relies a bit on my memory that 1.10 already sneaky did this, so that might be good to confirm first :D

What a journey this :D Fonts are really really hard ... and why most games just embed a single one and lets you deal with that :)

@LordAro
Copy link
Member

LordAro commented Apr 10, 2021

Perhaps the debug message could be improved by printing the string where the character is missing?

@Limyx826
Copy link
Contributor Author

Well setting the font to Arial does eliminate the message.

@TrueBrain
Copy link
Member

Okay, in that case, if you don't mind, I am going to close this ticket. As it is not so much a bug, but more that we finally show that something wasn't working before :) Which is a bonus .. too bad it took us a while to remember we added that. Sorry about that :D

Happy gaming!

@Limyx826
Copy link
Contributor Author

Thanks for the help anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue needs further investigation before it becomes actionable
Projects
None yet
Development

No branches or pull requests

3 participants