Repository navigation
fix(engine2d): text staging walks codepoints so one em dash cannot blank a page - #632
Merged
Merged
Conversation
…lank a page
`ResolvedFontMetrics.advances` carries one entry per CODEPOINT. The advance
re-layout paired it with a table of cumulative BYTE offsets, while the staged
quads carry a codepoint index in their field named `byte_offset` (both
LayoutGlyph producers increment it by 1 per glyph). On ASCII the two spaces
coincide; after one em dash every lookup missed, `font_batch_apply_advances`
returned false, the batch was marked invalid and the whole page's Draw IR drew
nothing -- two of eight catalog pages rendered zero pixels.
- font_advance_layout.spl: decode once with `text_codepoints`, index advances
and shifts per codepoint, resolve the quads' index space once per batch.
`font_advances_codepoint_arity` accepts BOTH conventions -- per-codepoint and
round 5's byte-expanded array, collapsed losslessly -- and returns [] for
anything else so the caller can fall back rather than reinterpret.
- draw_ir_adv.spl: the advance gate counts codepoints and normalises arity; a
producer may declare `font-advance-arity: codepoint|byte` on the command and
a declaration that disagrees with what arrived takes the fallback. A resolved
text run that still cannot be staged is now painted with the font's own
advances and recorded via `mark_cpu_fallback("text-advance-arity")`, never
dropping the composition. Shaped runs with a malformed payload stay
fail-closed.
- engine.spl: `mark_cpu_fallback_reason` forwards that receipt.
- check-chrome-catalog-pixel-diff.shs: a readable capture with no ink is now
`zero-pixel-render` and NAMES the page instead of counting as "unreadable";
keyed on the PPM, never on a log line. Two new selftest fixtures (5 total).
Specs: font_advance_codepoint_arity_spec 9/9, draw_ir_em_dash_text_ink_spec 2/2
(cpu_simd, interpreter). Sabotage (byte index space) reproduces the incident
signature `advances=23 text_len=25` with zero ink while ASCII stays green.
draw_ir_adv_spec is 69 examples / 25 failures both here and at origin/main --
a pre-existing red, offender lists byte-identical.
Catalog evidence (cpu_simd, interpreter, 900x760, all 8 pages): overview
337644, html 626974, css-layout 587715, css-paint 627026, forms-media 661438,
animation 661438, evidence 190568, tab-bar 45156 non-background pixels -- no
page at 0. html and css-layout are the two that rendered zero pixels in the
incident.
Pre-push, exit codes read into variables: conflict-markers PASS (28 files),
tree-size PASS (1 commit, base 136250 files), rt-dual-implementation PASS
(2519/2519, 0 new, 0 stale), test-tree-divergence-delta PASS (3209 pre-existing
offenders, 0 introduced -- pre-existing offender list saved at
/var/folders/.../test_tree_divergence_preexisting.txt, 3943 lines, recorded
here as required). check-guard-wiring FAILs on 2 NEW unwired guards,
check-blur-rect-spirv-pinned.shs and check-glass-material-spirv-pinned.shs,
both landed by a peer lane in 9ee2779 and untouched by this change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TVraTPgGDVypESTsVqXPgi
ormastes
temporarily deployed
to
self-review-admission
September 12, 2026 11:21 — with
GitHub Actions
Inactive
ormastes
deleted the
work/engine2d-text-staging-codepoints-2026-09-12
branch
September 12, 2026 11:22
This branch was previously deployed
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.
fix(engine2d): stage text quads per codepoint so one em dash cannot blank a page
ResolvedFontMetrics.advancescarries one entry per CODEPOINT. The advancere-layout paired it with a table of cumulative BYTE offsets, while the staged
quads carry a codepoint index in their field named
byte_offset(bothLayoutGlyph producers increment it by 1 per glyph). On ASCII the two spaces
coincide; after one em dash every lookup missed,
font_batch_apply_advancesreturned false, the batch was marked invalid and the whole page's Draw IR drew
nothing -- two of eight catalog pages rendered zero pixels.
text_codepoints, index advancesand shifts per codepoint, resolve the quads' index space once per batch.
font_advances_codepoint_arityaccepts BOTH conventions -- per-codepoint andround 5's byte-expanded array, collapsed losslessly -- and returns [] for
anything else so the caller can fall back rather than reinterpret.
producer may declare
font-advance-arity: codepoint|byteon the command anda declaration that disagrees with what arrived takes the fallback. A resolved
text run that still cannot be staged is now painted with the font's own
advances and recorded via
mark_cpu_fallback("text-advance-arity"), neverdropping the composition. Shaped runs with a malformed payload stay
fail-closed.
mark_cpu_fallback_reasonforwards that receipt.zero-pixel-renderand NAMES the page instead of counting as "unreadable";keyed on the PPM, never on a log line. Two new selftest fixtures (5 total).
Specs: font_advance_codepoint_arity_spec 9/9, draw_ir_em_dash_text_ink_spec 2/2
(cpu_simd, interpreter). Sabotage (byte index space) reproduces the incident
signature
advances=23 text_len=25with zero ink while ASCII stays green.draw_ir_adv_spec is 69 examples / 25 failures both here and at origin/main --
a pre-existing red, offender lists byte-identical.
Catalog evidence (cpu_simd, interpreter, 900x760, all 8 pages): overview
337644, html 626974, css-layout 587715, css-paint 627026, forms-media 661438,
animation 661438, evidence 190568, tab-bar 45156 non-background pixels -- no
page at 0. html and css-layout are the two that rendered zero pixels in the
incident.
Pre-push, exit codes read into variables: conflict-markers PASS (28 files),
tree-size PASS (1 commit, base 136250 files), rt-dual-implementation PASS
(2519/2519, 0 new, 0 stale), test-tree-divergence-delta PASS (3209 pre-existing
offenders, 0 introduced -- pre-existing offender list saved at
/var/folders/.../test_tree_divergence_preexisting.txt, 3943 lines, recorded
here as required). check-guard-wiring FAILs on 2 NEW unwired guards,
check-blur-rect-spirv-pinned.shs and check-glass-material-spirv-pinned.shs,
both landed by a peer lane in 9ee2779 and untouched by this change.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01TVraTPgGDVypESTsVqXPgi
🤖 Generated with Claude Code
https://claude.ai/code/session_01TVraTPgGDVypESTsVqXPgi