GUI: Enable font fallback on missing glyphs - #7948
Draft
ied206 wants to merge 6 commits into
Draft
Conversation
Support fallback declarations at the fonts, font and language scopes, with narrower scopes taking priority. Move Unifont into fonts.dat so the global fallback remains available in packages that omit fonts-cjk.dat. Assisted-by: Codex:gpt-5
Keep Unifont in fonts-cjk.dat so distributions may omit the CJK font archive. Add an optional fallback declaration flag so scalable-font themes silently continue when Unifont is unavailable, while required fallbacks retain their warnings. Assisted-by: Codex:gpt-5
ied206
force-pushed
the
gui-font-fallback
branch
from
September 13, 2026 17:33
89f3286 to
4bc3630
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Noto Sans KR.Noto Sans KR1.004 in fonts-cjk.dat does not have Han character glyphs.Screenshots
I rendered this text in ScummVM, with the UI language set to Korean to force the use of
Noto Sans KR, before/after the patch:Noto Sans KR, even 2.004, does not support the last character (U+9FFF 鿿). Unifont, a fallback, must render it.AS-IS
Noto Sans KR1.004 fails to render韓國,éand鿿.TO-BE
Noto Sans KR2.004 correctly renders韓國,é.Unifont, a fallback font, correctly renders鿿.PR Details
Font Fallback System
When a font is requested to draw a missing glyph in ScummVM, it simply omits rendering of that glyph.
This PR adds a fallback font glyph rendering system to mitigate this problem.
Graphics::Font::hasGlyph()function.kPresent/kAbsencewhen implemented.kUnknownon unimplemented derived classes, to prevent breaking. It is treated the same askPresent.hasGlyph()overload to theTTFFont, a class for freetype-backed fonts.Graphics::FallbackFontclass; an object handles multiple font instances.hasGlyphs()and renders the first glyph available.?as a last resort when even tofu is not available.<fonts>,<font>,<language>node can have a child node of<fallback>.Addition/Update of fonts
This PR also adds an OpenType variant of Unifont.
Unifontis a lightweight (~5MB) console/monospace-friendly font that aims to cover all Unicode codepoints.This PR sets
Unifontas a primary fallback font on freetype-based ScummVM themes.fonts-cjk.datis excluded from the build, the fallback system would silently disable the use ofUnifontin effect.I also updated the Noto Sans CJK font family files to 2.004 from 1.004.
Noto Sans KR.Future Work