Module paragraph
Expand description
Bounded local-font paragraph wrapping/shaping on UI or worker threads.
Line opportunities use pinned Unicode 15.0 data; paragraph bidi uses pinned Unicode 16.0 data. This is explicit single-font layout, not system fallback, dictionary breaking, discretionary hyphen insertion, justification or interactive input.
Structs§
- Paragraph
Layout - Owned immutable output retaining the original text, paragraph options and base direction. Font/shaping style identity remains caller-owned. Preparation allocates and repeatedly shapes candidate lines; backend transient work is not bounded by output caps and must never run in audio callbacks.
- Paragraph
Line - One logical line and its visual directional runs. The range excludes a hard separator, whose original bytes are retained separately. Baseline Y increases downwards, starting at zero; this is pen layout, not glyph ink bounds.
- Paragraph
Options - Explicit finite positive width and baseline spacing, in shaping size units. Whitespace is retained, so trailing-space advance participates in wrapping.
- Paragraph
Run - One visual run; glyph clusters remain relative to its original logical slice. Glyph positions use run-local coordinates. Place the run after its line’s alignment/baseline offset and this run’s horizontal offset.
Enums§
- Text
Alignment - Physical horizontal alignment; independent of paragraph writing direction.
Constants§
- MAXIMUM_
PARAGRAPH_ LINES - Maximum complete output lines, including empty lines after hard separators.
- MAXIMUM_
PARAGRAPH_ RUNS - Maximum complete output directional runs across all lines.