Repository navigation
feat(text): add shaper-verified tabular-digit template fast path for single-line LiveText - #2119
Merged
Merged
Conversation
…single-line LiveText
This was referenced Nov 25, 2026
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.
Refs #2084
Adds an internal, shaper-verified tabular-digit template fast path for single-line ASCII
LiveTextupdates (zero public API changes, noTextLayoutenum changes, novendor/patches).How it works
flowchart LR A[LiveText change] --> B{Printable ASCII 1..=64B with digit?} B -- no --> F[Full reshape: layout_live] B -- yes --> C{Cache key: mask + TextStyle + scale} C -- 1st seen --> O[Shape & record width: Observed] C -- 2nd distinct string --> W{full_width bits equal?} W -- no --> I[Mark Ineligible, 0 probes] W -- yes --> V[Verify: 10 uniform fills + 102B De Bruijn + GSUB/GPOS/kern/GDEF/AAT] V -- pass --> T[Verified Rc<TabularTemplate>] V -- fail --> I C -- Verified hit --> S[Swap digit glyph IDs in place, bump value_id] S --> P[Paint: glyphs_for_tabular + fold value_id into text_quads key]crates/rune-text/src/layout/tabular.rs,crates/rune-text/src/layout/tabular/tables.rs):'0'..='9') and asserts bit-identicalfull_width,width,height, all 12LineMetricsfields, run metadata, 1-to-1 LTR cluster ranges/advances/word boundaries, non-digit glyphs/positions, and digit positions/advances.GSUB/GPOS/GDEF/kerntables viaskrifa::raw(rejecting AATmorx/mort/kerx, multi-glyph ligatures overlapping digit slots such as1/2underfrac/dlig, and asymmetric contextual rules; allowing digit-symmetric rules like Inter'scaltcolon/hyphen shift).256masks /2 MiBLRU), cleared inTextSystem::drop_shaped().crates/rune/src/runtime/):TextLayout::Single(template_layout)innode.text_layoutand storesOption<Rc<TabularGlyphs>>onNodeCold::tabular_layout(updated in place viaRc::get_mutfor zero per-tick allocation).tabular_layoutalongsidetext_layoutacrossmemoreuse, relayout, and virtual remount; clears it whenever layout leaves the tabular path.TextSystem::glyphs_for_tabularinpaint/content.rs,paint/text_flights.rs, andmotion/flights.rs, foldingTabularGlyphs::value_id()intoPaintState::text_quads.Benchmark (
--profile perf, 9 paired alternating runs, 500 changed"000.00 bar"values/tick × 60 ticks, scale 2.0, headless CPU; excludes GPU upload/presentation)layout_live)layout_live_tabular_into)'tnum' 1'tnum' 1'tnum' 1'tnum' 1Verification
crates/rune-text/src/layout/tabular/tests.rs): bit-exact glyph IDs, positions,GlyphQuads (origin, zoom, glide, band,bytes), line box, caret geometry, hit testing, and selection rects across Inter Regular/Medium/SemiBold, IBM Plex Mono, proportional fallback,frac/dlig/ordn, RTL, control chars, and synthetic adversarial fonts (hidden pair kern, 3-digit ligature, separator ligature).Runtimetests (crates/rune/src/runtime/motion/tabular_live_text_tests.rs,memo_reuse_live_text_tests.rs): 500-cell grid, memo reuse across commits, paint-keep andtext_quadsinvalidation, selectable a11yTextRunparity, and font switching.rune-text,rune, doctests, clippy,check-wasm,check-webgl), macOS arm64 (rune-textandrunetabular tests), and Linux aarch64 (cargo check -p rune -p rune-kit --tests). Not run: live GPU window presentation.