Change: Support side-by-side fallback FontCaches instead of hierarchical. (#13303)

The text layouter system can now support using different fonts for different glyphs, including mixing scalable and sprite glyphs.
This commit is contained in:
Peter Nelson
2025-12-06 10:47:12 +00:00
committed by dP
parent a616855649
commit 5be16a658a
32 changed files with 784 additions and 481 deletions
+4 -3
View File
@@ -25,15 +25,16 @@ public:
const Sprite *GetGlyph(GlyphID) override { return nullptr; }
uint GetGlyphWidth(GlyphID) override { return this->height / 2; }
bool GetDrawGlyphShadow() override { return false; }
GlyphID MapCharToGlyph(char32_t key, [[maybe_unused]] bool allow_fallback = true) override { return key; }
GlyphID MapCharToGlyph(char32_t key) override { return key; }
std::string GetFontName() override { return "mock"; }
bool IsBuiltInFont() override { return true; }
static void InitializeFontCaches()
{
FontCache::caches.clear();
for (FontSize fs = FS_BEGIN; fs != FS_END; fs++) {
if (FontCache::Get(fs) != nullptr) continue;
FontCache::Register(std::make_unique<MockFontCache>(fs));
FontCache::Register(std::make_unique<MockFontCache>(fs), FontLoadReason::Default);
FontCache::UpdateCharacterHeight(fs);
}
}
};