pmacs/pmacs-gpu
Levi Neuwirth 8e4bc00015 feat(math): ChunkSource::MathBox and spacer width quantization
The suppression mechanism F2 forced: a RichChunk's only width is its text, so
a suppressed span reserves room with SPACER SPACES the way SourceTab already
does, quantized up to whole advances. Quantizing up keeps the projection
grid-aligned with the surrounding monospace text and keeps hit runs integral,
at the cost of under one advance of slack on the right.

Adding the variant to an exhaustive enum made the compiler enumerate every
seam it must participate in, which is why it is wired through all five rather
than the two I had in mind: projected_to_source, source_to_projected, the tab
expander's source remap, and offset_chunk_source. Hits anywhere inside a box
snap to the span start — the Adornment rule, because Q#MS4 gives the box no
interior byte map — and source positions inside it collapse to the box's left
edge, so text after the span accounts for the whole reserved width.

Two details the tab expander needed: a math chunk's spacer text is generated
rather than source, so it holds no tab byte to expand, and its suppressed
range is already in slice coordinates and never split, so a within-chunk
offset does not move it.

spacer_for_width guards its inputs: a non-finite width, a non-positive
advance, or a pathological ratio reserves nothing or clamps, rather than
panicking or minting an enormous string from a cast.

184 pmacs-gpu tests pass, including the 155 that predate this branch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-24 18:57:18 -04:00
..
fonts feat(math): bundle Latin Modern Math and read its MATH constants 2026-07-24 18:27:34 -04:00
src feat(math): ChunkSource::MathBox and spacer width quantization 2026-07-24 18:57:18 -04:00
Cargo.toml feat(math): bundle Latin Modern Math and read its MATH constants 2026-07-24 18:27:34 -04:00