fix(text): single source of truth for glyph advances (#479) - #480
Merged
Conversation
TestADR054_ShearVariableFont_BoldVsRegular failed locally with GPU CoverageFiller (SparseStrips) because at 40px, AA fringe pixels dominate glyph body — pixel count comparison inverts for bold vs regular. Root cause: SparseStrips (4×4 tiles) and AnalyticFiller (scanline) produce different sub-pixel coverage at small sizes. NOT a gvar bug — variations applied correctly (verified via TextPath coordinate comparison). Fix: increase to 80px where glyph body dominates over AA fringe. Both rasterizers now produce bold > regular consistently.
Introduce advanceResolver — unified advance resolution used by Advance(), Glyphs(), and AppendGlyphs(). Priority: TT hinted > HVAR > raw hmtx. This matches drawGlyphs' hintedOrRawAdvance() ensuring MeasureString and DrawString agree on character positions (Skia/Chrome pattern). Enterprise research: Skia, FreeType, Chrome all enforce measurement == rendering advances from a single source controlled by hinting level. Fixes #479
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
Enterprise research
Skia, FreeType, Chrome all enforce: measurement == rendering advances.
Fixes #479