If you're measuring text height in JavaScript, you're probably calling getBoundingClientRect and triggering expensive DOM reflows. Pretext sidesteps that entirely by using canvas-based measurement once, then doing pure math for every subsequent layout calculation. The pattern is clean: call prepare() when text or font changes, call layout() on every resize. It handles the tricky stuff like CJK line breaking, rich inline fragments with mixed fonts, and variable-width columns for floating images. The shrinkwrap and binary search examples show it's built for real layout problems, not just basic wrapping. Solid choice if you're building virtualized lists, preventing layout shift, or rendering text to canvas without DOM overhead.
npx skills add https://github.com/aradotso/trending-skills --skill pretext-text-measurement