renderer: glyph protocol#12938
Open
mitchellh wants to merge 4 commits into
Open
Conversation
Glossary entries own decoded glyph payloads, so callers could not copy an entry without sharing outline storage. Add clone methods for glossary entries and glyf outlines that allocate fresh contour and point slices while copying the scalar registration metadata directly. This keeps the ownership contract symmetric with deinit and lets cloned entries be released independently from their source.
Registered Glyph Protocol codepoints declare an authoritative terminal cell width, but printing still used the Unicode width table for all codepoints. This meant a registered wide PUA glyph could render across two cells while the terminal buffer, cursor advance, and wrapping logic treated it as narrow. Route print width calculation through a small helper that preserves the ASCII fast path and only checks the glossary when registrations exist and the codepoint is in a Private Use Area. Add glossary accessors for registered width and cover wide, narrow-overwrite, and edge-wrapping layout behavior with terminal tests.
glyf rasterization previously clipped output to the nominal cell-sized bitmap. When placement centered an outline wider than that nominal rectangle, the left and right overflow were discarded before the renderer could draw them. Allow the returned bitmap to grow horizontally to include the full Placement bounds, and report any left-side growth with a negative offset_x bearing. The renderer now passes that bearing through when creating the atlas glyph, so centered oversized glyf outlines render at their intended position instead of appearing clipped.
Contributor
Author
|
I fixed the issues. There is some hacky rasterization stuff because our placement logic isn't 100% spec compliant. I don't love it. I'm going to let this sit for a bit so I can sleep on it and consider some other approaches. |
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.
This adds the renderer part of the glyph protocol, tying together all the other work we did.