fix: preload fallback fonts on await draw and fix mesh '?' width - #56
Merged
Merged
Conversation
Single-pass awaitFonts must load default/symbol chains (e.g. amgdt for U+2205), and MeshFont not-found placeholders need getCharShape so advance width is non-zero. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
awaitFontsis enabled,MText/Shape.asyncDrawalso requests default/symbol fallback fonts fromgetFontsToLoad(), so single-pass draws can resolve glyphs like diameter (U+2205 → amgdt) without relying on a laterfontLoadedredraw.MeshFont.getNotFoundTextShapenow goes throughgetCharShape('?')so the glyph is loaded before measuring advance width, preventing zero-width placeholders that overlap the next character.@mlightcad/mtext-rendererto 0.12.4 and add regression coverage for both behaviors.Test plan
packages/mtext-renderervitest suite (includingmeshFont.notFoundandrender-remote-font-loading)awaitFontsBeforeDraw/awaitFonts: true, draw MText containing U+2205 and confirm diameter resolves on the first pass?with non-zero advance and no overlap with the following characterawaitFonts: false) still only request content/style fonts