diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/strings.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/strings.cpp b/src/strings.cpp index a98d7e966..fa039fdb9 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -2017,6 +2017,17 @@ bool MissingGlyphSearcher::FindMissingGlyphs() size = (FontSize)(c - SCC_FIRST_FONT); } else if (!IsInsideMM(c, SCC_SPRITE_START, SCC_SPRITE_END) && IsPrintable(c) && !IsTextDirectionChar(c) && c != '?' && GetGlyph(size, c) == question_mark[size]) { /* The character is printable, but not in the normal font. This is the case we were testing for. */ + std::string size_name; + + switch (size) { + case 0: size_name = "medium"; break; + case 1: size_name = "small"; break; + case 2: size_name = "large"; break; + case 3: size_name = "mono"; break; + default: NOT_REACHED(); + } + + DEBUG(freetype, 0, "Font is missing glyphs to display char 0x%X in %s font size", c, size_name.c_str()); return true; } } @@ -2110,6 +2121,19 @@ void CheckForMissingGlyphs(bool base_font, MissingGlyphSearcher *searcher) memcpy(&_freetype, &backup, sizeof(backup)); + if (!bad_font) { + /* Show that we loaded fallback font. To do this properly we have + * to set the colour of the string, otherwise we end up with a lot + * of artifacts.* The colour 'character' might change in the + * future, so for safety we just Utf8 Encode it into the string, + * which takes exactly three characters, so it replaces the "XXX" + * with the colour marker. */ + static char *err_str = stredup("XXXThe current font is missing some of the characters used in the texts for this language. Using system fallback font instead."); + Utf8Encode(err_str, SCC_YELLOW); + SetDParamStr(0, err_str); + ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_WARNING); + } + if (bad_font && base_font) { /* Our fallback font does miss characters too, so keep the * user chosen font as that is more likely to be any good than |