From dd233a9b70b5a405dbf6a5ed60cca0d6f6cd61db Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sat, 4 Apr 2026 21:51:29 +0100 Subject: [PATCH] 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. --- src/strings.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/strings.cpp b/src/strings.cpp index c25d770b6c..c24067cdaf 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -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