Change: Allow TrueType fonts to provide our private-use glyphs.

This commit is contained in:
Michael Lutz
2023-12-16 00:06:19 +01:00
parent 37610af0e4
commit 6e766a2e81
11 changed files with 29 additions and 27 deletions

View File

@@ -180,14 +180,10 @@ void CoreTextFontCache::SetFontSize(int pixels)
Debug(fontcache, 2, "Loaded font '{}' with size {}", this->font_name, pixels);
}
GlyphID CoreTextFontCache::MapCharToGlyph(char32_t key)
GlyphID CoreTextFontCache::MapCharToGlyph(char32_t key, bool allow_fallback)
{
assert(IsPrintable(key));
if (key >= SCC_SPRITE_START && key <= SCC_SPRITE_END) {
return this->parent->MapCharToGlyph(key);
}
/* Convert characters outside of the Basic Multilingual Plane into surrogate pairs. */
UniChar chars[2];
if (key >= 0x010000U) {
@@ -202,6 +198,10 @@ GlyphID CoreTextFontCache::MapCharToGlyph(char32_t key)
return glyph[0];
}
if (allow_fallback && key >= SCC_SPRITE_START && key <= SCC_SPRITE_END) {
return this->parent->MapCharToGlyph(key);
}
return 0;
}