TLDR Dev · LAUNCHES & TOOLS
PRETEXT
Summary from the TLDR Dev newsletter
Pretext is a pure JavaScript/TypeScript library for fast and accurate multiline text measurement and layout. It circumvents costly DOM reflows by implementing its own text measurement logic using the browser's font engine. The library has two primary use cases: calculating a paragraph's height without DOM interaction for purposes like virtualization, and providing tools to manually lay out text lines for rendering to Canvas, SVG, or server-side.