chenglou/pretext: Fast, accurate & comprehensive text measurement & layout

repo Chenglou

Pure JavaScript/TypeScript library for measuring and laying out multiline text without the DOM. Splits the process into two phases: a one-time preparation step (prepare) that measures glyphs via the canvas API, and a cheap hot path (layout) that runs pure arithmetic over cached values. Supports all languages, emoji, and bidirectional text. Works in browsers and Node.js.

https://github.com/chenglou/pretext