What it does
opentype.js parses and writes OpenType and TrueType font data in the browser or Node.js. It exposes glyph outlines, metrics and features, and its site includes font and glyph inspectors.
opentype.js exposes letter shapes as paths that JavaScript can inspect or draw. The browser demo lets you toggle points, metrics, kerning, ligatures and hinting; Font Inspector and Glyph Inspector offer more detail. That makes it useful for custom lettering graphics or a font-analysis interface.
For an integration, install the npm package, load a WOFF, OTF or TTF file into an ArrayBuffer and pass it to opentype.parse. A Font object can produce a text path, draw to a canvas or be written back to a font file. Width measurement and the visible bounding box are distinct: a trailing space affects the former even though it has no outline.
WOFF2 input needs decompression before parsing. Feature controls also have limits; the documented rendering options support the liga and rlig ligature features. Check complex text against its intended output before using the library as a complete text renderer.
Strengths
- Exposes outlines and metrics in browser and Node environments.
- Provides interactive font and glyph inspectors.
Watch out for
- WOFF2 input needs a separate decompression step.
- Feature support has documented limits.
Best for
- Developers making custom lettering or font-inspection tools.
- Browser experiments that manipulate glyph paths.
Sources
- opentype.js – JavaScript parser/writer for OpenType and TrueType fonts. (Oct 27, 2026)
- opentype.js official README (Oct 27, 2026)
- opentype.js MIT license (Oct 27, 2026)
- opentype.js Repository and API Documentation (Oct 27, 2026)
