How to batch apply latin filter across multi-weight font families
- Step 1Walk source weights — fs.readdir(input). For each *.ttf in src/fonts/, parse with opentype.js, build the latin keep-set (U+0020–U+00FF), emit a fresh subset Font, write to dist/fonts/.
- Step 2Compress to WOFF2 — Pipe each subset TTF through wawoff2.compress. Final output: brand-light-latin.woff2, brand-regular-latin.woff2, etc.
- Step 3Validate output — Add a CI test: ensure every output file is under 20 KB (catch regressions where someone accidentally widens the charset).
Frequently asked questions
Does each weight need its own subset?+
Yes — each weight is an independent font file. Latin Filter produces one output per input. The output is keyed by weight, not shared.
Can I parallelise the batch?+
Yes. Promise.all over the file list with concurrency 4–8. opentype.js parsing is single-threaded JS but each font is independent.
What about italic weights?+
Italic is a separate family in most cases. Run the script across both upright/family and italic/family-italic directories. Output mirrors the input structure.
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.