3/29/2026

Multilingual Browser-Aware Text Layout Engine Aims For Parity With Browser Wrapping Across Scripts

Pretext · Simon Willison's Weblog

Science, Technology & Innovation · Mar 29, 2026

Pretext implements multilingual segmentation and browser-aware wrapping that approximates real browser layout across mixed scripts, emojis, and edge cases, enabling more accurate, single-engine text layout for global, user-generated content.


3/29/2026

Preprocessing And Caching Offscreen Text Measurements Enables Fast Repeated Layout Calculations Without DOM Measurements

Pretext · Simon Willison's Weblog

Science, Technology & Innovation · Mar 29, 2026

Pretext speeds up browser text layout by running a one-time prepare() that measures text segments on an off-screen canvas and caches those metrics, then using cheap repeated layout() calls to emulate word wrapping and compute line counts/heights without DOM measurement—making interactive, width-dependent text effects practical.


3/29/2026

Validation Should Be Grounded In Corpus-Scale Browser Rendering Comparisons Rather Than Isolated Unit Tests

Pretext · Simon Willison's Weblog

Science, Technology & Innovation · Mar 29, 2026

Pretext validated its layout estimator against corpus-scale “browser truth” by rendering large, multilingual documents (e.g., the full Great Gatsby and long Thai/Chinese/Korean/Japanese/Arabic texts) across browsers and widths and iteratively calibrating models (via Claude Code/Codex) to match real browser outputs, implying builders should use corpus-level diff testing against browser rendering rather than isolated short-English unit tests.


3/29/2026

Small Client-Side Library Offloads Text Measurement to Improve Performance for Text-Heavy Web Apps

Pretext · Simon Willison's Weblog

Science, Technology & Innovation · Mar 29, 2026

A tiny client-side library (Pretext) shifts text measurement from costly DOM reads to off-screen preprocessing, caching, and browser-quirk-aware wrapping emulation—making repeated measurements much faster and enabling new text-heavy UI features with minimal bundle overhead.