What problem does it solve?
Build, refactor, debug, and review browser UI code that uses Pretext for DOM-free multiline text measurement and manual text layout via prepare, layout, prepareWithSegments, layoutWithLines, walkLineRanges, layoutNextLine, clearCache, or setLocale. Use when Codex must predict text height without DOM reads, preserve line count while shrinkwrapping, route text around shapes or varying-width slots, hand text across columns, or compose measured inline fragments in JS/TS.
Core Features & Use Cases
- DOM-free measurement APIs: prepare, layout, and the manual-line tools to compute heights, widths, and line fragments without DOM reads.
- Shape- and column-aware layouts: route text around obstacles and across columns with precise control over line breaks.
- Caching and locale support: shared caches with setLocale and clearCache to optimize repeated measurements.
Quick Start
Call prepare(text, font) to analyze text, then layout(prepared, maxWidth, lineHeight) to obtain height or lines.