How to audit a font library for extension/format mismatches
- Step 1Inventory the fonts directory — Walk every font file across src/fonts, public/fonts, and any third-party design-token packages. Capture file path, size, extension, and the first 4 bytes.
- Step 2Run format identification — For each file, run the magic-byte check. Flag every mismatch (e.g., .otf with TTF magic, .ttf with WOFF2 magic). Cross-check sizes against expected ranges per format.
- Step 3Generate the audit report — Output a CSV: filename, declared format, actual format, status (OK / MISMATCH / CORRUPT). Share with the design team for triage. Most mismatches are safe to rename; corrupt files need re-download from upstream.
Frequently asked questions
How common are format mismatches in real codebases?+
More common than you'd expect — typical inherited design systems have 5–15% mismatch rate. Cause: someone renamed a downloaded font to fit the existing naming convention without checking format.
Are mismatches always wrong?+
No — sometimes the file is functionally correct (it's still a valid sfnt) and only the extension is wrong. Renaming to match the actual format fixes it without re-fetching.
What about WOFF2 files mislabeled as WOFF?+
These will fail to load in older browsers that lack WOFF2 support — the browser tries to decompress a Brotli stream as zlib and gets garbage. Fix by renaming to .woff2 and updating @font-face src declarations.
How do I prevent future mismatches?+
Wire the format-check script into CI (see the CI Validation guide). Every PR gets validated; mismatched files block the merge with a clear error. Once your baseline is clean, regressions stop happening.
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.