Fix f864aaf131: refresh string width cache for all loaded fonts (#15427)

Cache needs to be loaded for all font sizes, not just those that were missing glyphs.
This commit is contained in:
Peter Nelson
2026-04-04 21:51:29 +01:00
committed by GitHub
parent cdb548c252
commit dd233a9b70
+3 -6
View File
@@ -2421,6 +2421,9 @@ void CheckForMissingGlyphs(MissingGlyphSearcher *searcher)
}
#endif
/* Update the font width cache */
LoadStringWidthTable(searcher->fontsizes);
if (bad_font) {
/* All attempts have failed. Display an error. As we do not want the string to be translated by
* the translators, we 'force' it into the binary and 'load' it via a BindCString. To do this
@@ -2431,15 +2434,9 @@ void CheckForMissingGlyphs(MissingGlyphSearcher *searcher)
builder.PutUtf8(SCC_YELLOW);
builder.Put("The current font is missing some of the characters used in the texts for this language. Go to Help & Manuals > Fonts, or read the file docs/fonts.md in your OpenTTD directory, to see how to solve this.");
ShowErrorMessage(GetEncodedString(STR_JUST_RAW_STRING, std::move(err_str)), {}, WL_WARNING);
/* Reset the font width */
LoadStringWidthTable(searcher->missing_fontsizes);
return;
}
/* Update the font with cache */
LoadStringWidthTable(searcher->missing_fontsizes);
#if !(defined(WITH_ICU_I18N) && defined(WITH_HARFBUZZ)) && !defined(WITH_UNISCRIBE) && !defined(WITH_COCOA)
/*
* For right-to-left languages we need the ICU library. If