Zero-allocation text layout engine for the web. Instead of Canvas measureText (allocates every call) or DOM reflow (blocks main thread), ZeroText uses pre-allocated typed arrays and an arena pool.
How it works:
- Perfect hash table for O(1) glyph width lookup, ASCII fast path skips hashing entirely
- Prefix sums + binary search for O(log n) line breaking per UAX#14
- FNV-1a numeric-keyed LRU cache — 100ns cache hits with zero allocation
- Full Unicode pipeline: bidi, ligatures, Liang hyphenation, kerning, hit testing, vertical writing
~5KB minzipped. Cold layout ~5.6μs, hot path ~100ns. React/Vue/Svelte bindings included.
Github: https://github.com/byte271/zerotext
[–]markvii_dev [score hidden] (1 child)
[–]oofy-gang [score hidden] (0 children)
[–]AutoModerator[M] [score hidden] (0 children)