Fix custom font fallback rendering#6485
Open
gta66666668 wants to merge 2 commits into
Open
Conversation
| } | ||
|
|
||
| public static List<FontFace> getFallbackFonts(FontFace primary) { | ||
| List<FontFace> fonts = new ArrayList<>(); |
Contributor
There was a problem hiding this comment.
Why you even need a list here? Isn't this just an Optional<FontFace>
Author
There was a problem hiding this comment.
Changed. You are right: this path selects at most one fallback face, so returning a List<FontFace> made the API more general than the implementation actually was. getFallbackFont(FontFace) now returns Optional<FontFace>, and readFontBuffers consumes it directly with flatMap / ifPresent.
I also tightened the related rendering path while rebasing this PR onto the latest master:
- fallback selection skips the entire primary family, prefers the primary style, then Regular, and uses locale-stable name matching;
- primary/fallback font buffers are loaded once and reused by GUI/HUD font sizes instead of rereading large CJK font files for every height;
- width measurement now caches glyph metrics without rasterizing into (and consuming) the texture atlas;
- missing prepacked glyphs correctly fall through to the fallback font, while supplementary Unicode code points remain handled as code points rather than UTF-16 chars;
- partially filled initial atlases are accepted safely, missing/unpackable glyphs are cached, and one packing failure no longer disables all later glyphs;
- renderer replacement and font cleanup are now atomic/idempotent, with HUD font resets deferred until the current frame finishes.
Validated with ./gradlew.bat build --stacktrace --console=plain (BUILD SUCCESSFUL).
gta66666668
force-pushed
the
codex/chinese-font-fallback
branch
from
July 18, 2026 12:21
67cdf45 to
18bb92d
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.
Fixes custom text rendering for glyphs that are not present in the selected Meteor font, such as Chinese characters.
The previous custom font renderer pre-packed a fixed set of Latin, Greek, Cyrillic, and symbol ranges. Characters outside those ranges could not render even when the OS had a suitable font installed.
Changes:
Validation:
This PR is based on master and does not include the Minecraft 26.2 update branch.