cn-font-split splits large font files into smaller web-ready packages with consistent output across platforms. It supports TTF, OTF, and WOFF2, including complex and variable fonts, via Node or WASM.
Overview
cn-font-split is the font subsetting tool used by the Chinese Web Fonts Plan to break huge fonts into network-friendly chunks. Splitting follows the characters actually present in the font, with optimizations for Chinese, Japanese, Korean, minority scripts, and Arabic text.
The Rust core runs through Node FFI or WASM, producing WOFF2 chunks, generated CSS, optional reports, test HTML, and preview images. Configurable chunk size, manual subsets, and naming templates control how packages are sized and hashed with blake3 fingerprints.
Platform-specific native binaries ship as optional npm packages for macOS, Windows, and Linux, with separate WASI packages for in-browser use. A CLI and JavaScript API accept font paths or buffers and write artifacts to a chosen output directory.
Node.js 22 or newer is required for current releases. Custom native builds can override the binary path with CNFONTSPLITBIN. Bun and Deno entry points exist as best-effort integrations.
Key features
- Multi-threaded TTF OTF WOFF2 subsetting
- CJK and broad script-aware chunking
- Generated CSS and blake3-named outputs
- Node FFI and browser WASM paths
- Variable and complex glyph support
- Configurable chunk size and subsets
- Optional preview and reporter artifacts
Use cases
- Web font package size control
- Chinese web font CDN workflows
- Splitting fonts for static sites
- In-browser font processing via WASM