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 stories in your inbox.

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

Related Stories

Browse Programming
ProgrammingAug 23, 2026

Rust Glancer

Rust-analyzer's memory bloat stems from treating all 6,666 dependencies equally — a tiered, IntelliJ-style backend could fix that.