SMRTR ProgrammingMar 29, 2026lobste.rs

TypeScript library for multiline text measurement & layout

SMRTR summary

Pretext is a JavaScript/TypeScript library that measures and layouts multiline text without triggering expensive DOM reflows. It uses canvas-based measurement with browser font engines for accuracy, supporting complex text including emojis and bidirectional languages. The library enables precise text height calculations for virtualization and custom layouts, plus manual line-by-line rendering for canvas, SVG, and server-side use cases.

SMRTR provides this summary for quick context. The original article belongs to lobste.rs.

Read the original article
SMRTR Programming

Get the next batch of curated summaries in your inbox.

This archive is built from SMRTR newsletter summaries. Subscribe for hand-picked stories without the extra noise.