How to automate font subsetting in your build pipeline
- Step 1Define your charsets — subsets.config.json: { "latin": "latin", "latin-ext": "latin-ext", "cyrillic": "cyrillic" }. The pipeline produces one subset per entry per font.
- Step 2Walk fonts and apply subsetter — For each font × subset combo, parse with opentype.js, build the kept-glyph list, emit a fresh Font via the Font constructor, save the result.
- Step 3Compress to WOFF2 — Pipe each subsetted TTF through wawoff2.compress. Final output: family-latin.woff2, family-latin-ext.woff2, family-cyrillic.woff2 — all ready for unicode-range @font-face.
Frequently asked questions
Should I commit subsetted outputs?+
Most teams do — keeps deploys reproducible. Alternative: regenerate at build time and trust your CI cache. Pick based on your repo size tolerance.
Does opentype.js's subset preserve OT features?+
Partially. Glyph outlines and metrics are preserved; GSUB/GPOS layout features may be reduced. For complex scripts (Arabic, Devanagari), verify the result with end-to-end visual tests.
What if my font has CFF outlines (OTF)?+
opentype.js's Font writer falls back gracefully but may produce TTF outlines from CFF inputs. For pixel-perfect CFF preservation, use fonttools instead — but for most web delivery the small visual difference is invisible.
Privacy first
Every JAD Font tool runs entirely in your browser using opentype.js and the wawoff2 WASM Brotli encoder. Your fonts never leave your device — verified by zero outbound network requests during processing.