mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Fallback font searcher looked for the substituted ? glyph, which was removed by #12736. Instead of comparing against a sprite, test against the font returning a missing glyph. This should also improve performance of fallback font searching, as previously glyphs were actually rendered while searching.
This commit is contained in:
parent
5bca185923
commit
7e914a0568
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user