OSS
chenglou/pretext: Midjourney Engineer Ships 500x Faster Text Layout Library, Trending at 6.8K Stars
Cheng Lou (Midjourney, React contributor) released Pretext, a pure TypeScript library for multiline text measurement and layout that bypasses DOM measurements entirely. It uses Canvas API for one-time measurement then computes line breaks, heights, and positioning through math — 0.09ms for 500 text blocks vs expensive getBoundingClientRect() reflows. Currently trending on GitHub and Hacker News with 6.8K+ stars in days, though still under active development with SSR not yet implemented.
Source
↳ Follow the thread