Skip to content

renderer: glyph protocol#12938

Open
mitchellh wants to merge 4 commits into
mainfrom
push-tuwykoykluyz
Open

renderer: glyph protocol#12938
mitchellh wants to merge 4 commits into
mainfrom
push-tuwykoykluyz

Conversation

@mitchellh
Copy link
Copy Markdown
Contributor

@mitchellh mitchellh commented Jun 6, 2026

This adds the renderer part of the glyph protocol, tying together all the other work we did.

CleanShot 2026-06-05 at 21 16 41@2x

mitchellh added 2 commits June 5, 2026 20:02
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.
@mitchellh mitchellh added this to the 1.4.0 milestone Jun 6, 2026
@mitchellh mitchellh requested review from a team as code owners June 6, 2026 03:45
@mitchellh mitchellh added renderer vt Control sequence related labels Jun 6, 2026
mitchellh added 2 commits June 5, 2026 21:02
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.
@mitchellh
Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

renderer vt Control sequence related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant