Read OSS

chenglou/pretext

6 articles

Prerequisites

01

Pretext Architecture: Why Two Phases Beat DOM Measurement

Explores the core architectural insight behind Pretext: separating one-time text analysis from pure-arithmetic layout computation

02

Inside the Text Analysis Pipeline: From Raw String to Measured Segments

Deep-dives into whitespace normalization, Intl.Segmenter, the merge cascade, and Canvas measurement that transform raw text into parallel arrays

03

The Line Breaking Engine: Fast-Path Arithmetic and Browser Parity

Dissects the line-breaking engine in line-break.ts, the hot path executing in microseconds with simple vs full walker dispatch

04

Browser Quirks, Emoji Correction, and World Script Support

Covers cross-browser engine profiles, emoji width correction, the segment metric cache, bidi implementation, and world script handling

05

Rich Layout APIs in Action: Shrinkwrap, Obstacle Routing, and Editorial Spreads

Explores the rich tier of Pretext's API through chat bubble shrinkwrap, editorial obstacle routing, and SVG polygon hull extraction

06

Validating Text Layout: Corpora, Browser Sweeps, and Accuracy at Scale

Examines Pretext's testing infrastructure: deterministic fake canvas, browser accuracy sweeps, multilingual corpus validation, and RESEARCH.md as institutional memory