Discover Beautiful Things Built with Pretext
A community wall of projects powered by Cheng Lou's pure JS text measurement library — no DOM reflow, full i18n, sub-millisecond.
Industrial-age computing has reached a new peak. Pretext — the pure JavaScript text measurement library by Cheng Lou — has stormed the frontend world with a promise no library has kept before: measure text accurately, at sub-millisecond speed, without ever touching the DOM. No getBoundingClientRect. No offsetHeight. No layout reflow.
The library achieves this by running the browser's own font engine as ground truth via Canvas measureText, then performing pure arithmetic over cached segment widths. prepare() does the one-time analysis; layout() is the hot path thereafter — a mere 0.09ms for a 500-text batch. The community has taken notice.
"It is a dawn of a new era," declared one contributor. From masonry grids to shrink-wrapped pull-quotes, from pre-measured buttons to jitter-free counters — Pretext unlocks layout primitives the web has been missing for decades. Proper virtualisation without guesstimates. Balanced text. Zero layout shift.
This very page uses Pretext in four distinct ways: the masthead font-size is binary-searched to fill the container in one line; the pull-quote is shrink-wrapped via walkLineRanges; the counter is pre-sized to the final digit count; and every submit button label is pre-measured so the UI never reflows mid-animation.
Tweet unavailable
Tweet unavailable
Tweet unavailable
Tweet unavailable
Tweet unavailable
Tweet unavailable
Tweet unavailable
Tweet unavailable
Tweet unavailable
Tweet unavailable
Tweet unavailable
Tweet unavailable
Tweet unavailable
Tweet unavailable
Tweet unavailable
Building something with Pretext?