diff --git a/src/strings.cpp b/src/strings.cpp index 8a23b93daa..e069370e94 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -2158,23 +2158,20 @@ const char *GetCurrentLanguageIsoCode() bool MissingGlyphSearcher::FindMissingGlyphs() { InitFontCache(this->Monospace()); - const Sprite *question_mark[FS_END]; - - for (FontSize size = this->Monospace() ? FS_MONO : FS_BEGIN; size < (this->Monospace() ? FS_END : FS_MONO); size++) { - question_mark[size] = GetGlyph(size, '?'); - } this->Reset(); for (auto text = this->NextString(); text.has_value(); text = this->NextString()) { auto src = text->cbegin(); FontSize size = this->DefaultSize(); + FontCache *fc = FontCache::Get(size); while (src != text->cend()) { char32_t c = Utf8Consume(src); if (c >= SCC_FIRST_FONT && c <= SCC_LAST_FONT) { 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]) { + fc = FontCache::Get(size); + } else if (!IsInsideMM(c, SCC_SPRITE_START, SCC_SPRITE_END) && IsPrintable(c) && !IsTextDirectionChar(c) && fc->MapCharToGlyph(c, false) == 0) { /* The character is printable, but not in the normal font. This is the case we were testing for. */ std::string size_name;