Repository navigation
perf(deps): go-opentype/opentype v0.21.1, glyph outlines decoded once - #411
Merged
Merged
Conversation
Sub-pixel raster text rasterised each glyph at up to four phases, decoding and flattening its outline each time. v0.21.1 caches the flattened outline per glyph and bounds the caches. BenchmarkRenderInlineFontFace: 1990 -> 1455 allocs/op (1659 before sub-pixel text). Output is unchanged. Closes #410 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.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.
Bumps go-opentype/opentype to v0.21.1 (go-opentype/opentype#68): each glyph outline is decoded and flattened once per face, each sub-pixel phase is rasterised from it,
flattenContourdrops three copies, and the glyph, outline and phase caches are bounded (4096 glyphs, 16384 phased masks), so a hostile font cannot grow them.BenchmarkRenderInlineFontFace: 1990 -> 1455 allocs/op (1659 before fix(paint): draw raster text at the exact size with a sub-pixel pen #408), 6450799 -> 6319468 B/op. Allocation counts are exact; timings are not claimed (load).TestRasterTextMatchesChromeWords(Chrome comparison) pass.bench/go.modtidied for the new version.Closes #410
🤖 Generated with Claude Code