Skip to content

feat(text): bound and extend justification (11.14 layer 3) - #69

Open
thejustinwalsh wants to merge 2 commits into
feat/paragraph-spacing-indentfrom
feat/justification-controls
Open

feat(text): bound and extend justification (11.14 layer 3)#69
thejustinwalsh wants to merge 2 commits into
feat/paragraph-spacing-indentfrom
feat/justification-controls

Conversation

@thejustinwalsh

@thejustinwalsh thejustinwalsh commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

What

Layer 3 of the 11.14 typography tier: professional justification bounds.

Semantics

  • Expansion: word spaces grow uniformly up to maxWordSpaceRatio × their natural advance sum; the remaining deficit spills into inter-cluster letter gaps bounded by letterSpaceExpansion per gap; any residue reads as an under-full line.
  • Compression: a declared minWordSpaceRatio makes spaces elastic both ways. The line breaker lends the shrinkable fraction back while scanning — admitting the word that would otherwise just overflow, detected through a new CLUSTER_SPACE flag stamped at cluster build — and the positioning pass compresses those spaces to exactly the same bound, so break admission and paint always agree.
  • lastLine: 'justify' extends justification to final and hard-broken lines.
  • Zero-valued controls reproduce the pre-tier equal-space distribution bit-for-bit; measurement mirrors every branch through the shared positioned_fragment_advance.

Evidence

Red-green: distribution unit tests (cap spill into bounded gaps, shrink clamp at the declared minimum, last-line gates), a breaker admission test (rigid line breaks after the space; a 0.5 shrink fraction fits the whole run), and a Three integration segment — an unbounded justified last line fills its exact 300-unit box, while capped word growth plus a 0.5 letter-gap bound lands at natural-plus-gaps exactly. 180 Rust lib tests; full package check green.

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size
Core JS (gzip) 18.47 KB (0%)
Shaper Wasm (gzip) 418.38 KB (-0.15% 🔽)
Three.js adapter JS (gzip) 60.38 KB (0%)
Inter font · Bitmap (gzip) 545.27 KB (0%)
Inter font · MTSDF (gzip) 6.48 MB (0%)
Inter font · Slug (gzip) 604.06 KB (0%)
Font Awesome icons · Bitmap (gzip) 439.53 KB (0%)
Font Awesome icons · MTSDF (gzip) 6.89 MB (0%)
Font Awesome icons · Slug (gzip) 642.64 KB (0%)
Font validator JS (gzip) 134.24 KB (0%)
Runtime bake host JS (gzip) 5.38 KB (0%)
Runtime bake Worker JS (gzip) 142.45 KB (0%)
Font baker JS (gzip) 2.41 KB (0%)
Font baker Wasm (gzip) 379.63 KB (0%)
Bitmap baker JS (gzip) 4.66 KB (0%)
Bitmap baker Wasm (gzip) 228.31 KB (0%)
MTSDF baker JS (gzip) 5.39 KB (0%)
MTSDF baker Wasm (gzip) 209.22 KB (0%)
Slug baker JS (gzip) 4.01 KB (0%)
Slug baker Wasm (gzip) 181.24 KB (0%)

Word spaces expand uniformly up to the declared maximum ratio of their
natural advance sum; the remaining deficit spills into inter-cluster
letter gaps bounded per gap; residue reads as an under-full line. A
declared minimum ratio makes spaces elastic both ways: the breaker
lends the shrinkable fraction back while scanning, admitting the word
that would otherwise just overflow through a new CLUSTER_SPACE flag,
and positioning compresses those spaces to exactly the same bound. The
last-line policy justifies final and hard-broken lines on request.
Measurement mirrors every branch through positioned_fragment_advance.
Proven red-green at distribution, breaker, and Three integration
levels.
@thejustinwalsh
thejustinwalsh force-pushed the feat/justification-controls branch from 8a40d60 to a238430 Compare August 12, 2026 06:00
@thejustinwalsh
thejustinwalsh marked this pull request as ready for review August 14, 2026 02:34
# Conflicts:
#	docs/packages/benchmarks.md
#	docs/packages/glyph.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant