Pretext: a JavaScript/TypeScript library for multiline text height measurement and per-line layout.
Key features:
- Measures text height via canvas glyph widths. No DOM reflow
- Supports RTL scripts, bidirectional text, and emoji out of the box
- Provides line-by-line iterators for canvas, SVG, and WebGL rendering
- Variable-width column flow for float-aware text layout
- TypeScript type definitions included
A great pick if you're building virtualized lists, masonry grids, or any custom text renderer that needs pixel-accurate paragraph heights at scale.
👉 Blog Post
👉 GitHub Repo
👉 Live Demo
Top comments (0)