* Check whether there are glyphs missing in the current language. * @return If glyphs are missing, return \c true, else return \c false. */
| 2304 | * @return If glyphs are missing, return \c true, else return \c false. |
| 2305 | */ |
| 2306 | bool MissingGlyphSearcher::FindMissingGlyphs() |
| 2307 | { |
| 2308 | FontCache::LoadFontCaches(this->Monospace() ? FontSizes{FS_MONO} : FONTSIZES_REQUIRED); |
| 2309 | |
| 2310 | this->Reset(); |
| 2311 | for (auto text = this->NextString(); text.has_value(); text = this->NextString()) { |
| 2312 | FontSize size = this->DefaultSize(); |
| 2313 | FontCache *fc = FontCache::Get(size); |
| 2314 | for (char32_t c : Utf8View(*text)) { |
| 2315 | if (c >= SCC_FIRST_FONT && c <= SCC_LAST_FONT) { |
| 2316 | size = (FontSize)(c - SCC_FIRST_FONT); |
| 2317 | fc = FontCache::Get(size); |
| 2318 | } else if (!IsInsideMM(c, SCC_SPRITE_START, SCC_SPRITE_END) && IsPrintable(c) && !IsTextDirectionChar(c) && fc->MapCharToGlyph(c, false) == 0) { |
| 2319 | /* The character is printable, but not in the normal font. This is the case we were testing for. */ |
| 2320 | Debug(fontcache, 0, "Font is missing glyphs to display char 0x{:X} in {} font size", static_cast<uint32_t>(c), FontSizeToName(size)); |
| 2321 | return true; |
| 2322 | } |
| 2323 | } |
| 2324 | } |
| 2325 | return false; |
| 2326 | } |
| 2327 | |
| 2328 | /** Helper for searching through the language pack. */ |
| 2329 | class LanguagePackGlyphSearcher : public MissingGlyphSearcher { |
no test coverage detected