mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-26 05:34:12 +01:00
Fix: Bootstrap ignored default OpenTTD truetype fonts. (#14684)
Bootstrapping assumed that glyphs must be missing if there is no baseset, ignoring whether there actually are glyphs missing.
This commit is contained in:
@@ -380,7 +380,7 @@ bool HandleBootstrap()
|
||||
/* Initialise the font cache. */
|
||||
InitializeUnicodeGlyphMap();
|
||||
/* Next "force" finding a suitable non-sprite font as the local font is missing. */
|
||||
CheckForMissingGlyphs(false);
|
||||
CheckForMissingGlyphs();
|
||||
|
||||
/* Initialise the palette. The biggest step is 'faking' some recolour sprites.
|
||||
* This way the mauve and gray colours work and we can show the user interface. */
|
||||
|
||||
@@ -94,6 +94,7 @@ void InitializeUnicodeGlyphMap(FontSize fs)
|
||||
SetUnicodeGlyph(fs, unicode_map.code, 0);
|
||||
} else {
|
||||
SpriteID sprite = base + key - ASCII_LETTERSTART;
|
||||
if (!SpriteExists(sprite)) continue;
|
||||
SetUnicodeGlyph(fs, unicode_map.code, sprite);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2356,15 +2356,14 @@ class LanguagePackGlyphSearcher : public MissingGlyphSearcher {
|
||||
* mean it might use characters that are not in the
|
||||
* font, which is the whole reason this check has
|
||||
* been added.
|
||||
* @param base_font Whether to look at the base font as well.
|
||||
* @param searcher The methods to use to search for strings to check.
|
||||
* If nullptr the loaded language pack searcher is used.
|
||||
*/
|
||||
void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
|
||||
void CheckForMissingGlyphs(MissingGlyphSearcher *searcher)
|
||||
{
|
||||
static LanguagePackGlyphSearcher pack_searcher;
|
||||
if (searcher == nullptr) searcher = &pack_searcher;
|
||||
bool bad_font = !base_font || searcher->FindMissingGlyphs();
|
||||
bool bad_font = searcher->FindMissingGlyphs();
|
||||
#if defined(WITH_FREETYPE) || defined(_WIN32) || defined(WITH_COCOA)
|
||||
if (bad_font) {
|
||||
/* We found an unprintable character... lets try whether we can find
|
||||
@@ -2390,7 +2389,7 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher)
|
||||
ShowErrorMessage(GetEncodedString(STR_JUST_RAW_STRING, std::move(err_str)), {}, WL_WARNING);
|
||||
}
|
||||
|
||||
if (bad_font && base_font) {
|
||||
if (bad_font) {
|
||||
/* Our fallback font does miss characters too, so keep the
|
||||
* user chosen font as that is more likely to be any good than
|
||||
* the wild guess we made */
|
||||
|
||||
@@ -195,6 +195,6 @@ public:
|
||||
bool FindMissingGlyphs();
|
||||
};
|
||||
|
||||
void CheckForMissingGlyphs(bool base_font = true, MissingGlyphSearcher *search = nullptr);
|
||||
void CheckForMissingGlyphs(MissingGlyphSearcher *search = nullptr);
|
||||
|
||||
#endif /* STRINGS_FUNC_H */
|
||||
|
||||
@@ -923,7 +923,7 @@ void TextfileWindow::LoadText(std::string_view buf)
|
||||
this->AfterLoadText();
|
||||
this->ReflowContent();
|
||||
|
||||
CheckForMissingGlyphs(true, this);
|
||||
CheckForMissingGlyphs(this);
|
||||
|
||||
/* The font may have changed when searching for glyphs, so ensure widget sizes are updated just in case. */
|
||||
this->ReInit();
|
||||
|
||||
Reference in New Issue
Block a user