What problem does it solve?
Pretext solves the challenge of measuring and laying out multiline text with precision in the browser without relying on DOM reflow or bounding-box reads, so your visuals can be driven by accurate typography.
Core Features & Use Cases
- DOM-free measurement & layout: Compute line breaks, per-line widths, and per-grapheme positions from (text, font, width) using canvas measurement.
- Variable-width streaming for flowing text: Continuously ask pretext for the next line range that fits a corridor width (ideal for text that wraps around moving shapes).
- Creative primitive for generative demos: Build text-as-geometry effects (kinetic typography, particle shatters, ASCII-from-prose obstacle layouts) where you draw everything from returned layout numbers.
- Use case: When a user drags an orb across the screen, render paragraphs that actively flow around the orb’s changing silhouette using row-by-row available widths.
Quick Start
Ask Hermes to generate a single-file HTML “pretext demo” where text reflows around a moving obstacle and ships with an immediately visible first-paint style choice.