Chinese Web Font Cutting Tool 7.0 —— Rust Speed

| Chinese website plan | Github | Use online |
|---|
Introduction
cn-font-split is a font subcontracting tool used in the Chinese web font program . It splits huge font packages into versions suitable for network distribution through various high-performance technologies. After seven major versions of font research and code iteration, this technology has been fully applied in our website, achieving a double leap in the loading speed and efficiency of Chinese fonts in the Web field.
cn-font-split not only supports Chinese, but also optimizes for Chinese, Korean, Japanese, ethnic minority, Arabic, etc. It can be subcontracted intelligently based on the characters in the actual font package.
-
WebAssembly or Rust FFI implementation, run subcontracts natively, and enter second-level construction; - Adhere to the Web platform as the basis and has extremely strong compatibility. Browser, Node, Deno, CICD environments can all run. Rust, JS, Python is used in multiple languages.
- ? Complete functions, support generation of text and picture previews, support full and full characters, support complex glyphs, and support variable fonts!
- ⛰️ Self-developed Rust tool, build a text SVG engine, and independently render text images.
- ? We have front-end compiler plug-in! —— vite-plugin-font, supports Vite, Nuxt, Next, Webpack, Rspack, and quickly embed your front-end toolchain.
Opentype Feature Support 95 | Partial support 9 | Waiting for test 20
Usage Documentation Guide
If you want to support certain languages, you can submit Issues or PR.
New version features
- ✅ Native build support, speed enters the era of seconds (2MB font only requires 50ms)!
- ✅ Complete testing and version release process!
- ✅ ? More anthropomorphic source code, maintenance difficulty plummeted!
- ✅ Dependency checking and refactoring, secure version.
- ✅ ? More controllable subcontracting method, supporting fine-grained character splitting.
- ✅ ? Supports OTF format font packaging and supports complex glyph rendering.
- ✅ ?️ Font preview image generation
- ✅ ⌨️ Support Nodejs, Deno, Bun, and Browser, and can be used everywhere across platforms and build products consistently!
- ✅ ? Not only Chinese, as long as the characters in the package are subpackaged
- ✅ ?️ Supports automatic recognition of variable font weights
grateful
- The core plug-in of the project is Harfbuzz, which provides us with professional-level font subsetting and font drawing functions. We used the Rust version of harfbuzz_rs_now to embed the Rust code ecosystem, achieving a very ideal font subsetting effect.
- The Rust opentype project provides unparalleled font information extraction capabilities, providing a strong foundation for font characteristics and subcontracting algorithms.
- The Rust Cross project provides powerful Rust cross-platform product building capabilities.
- Special thanks - Tongyi Qianwen and GPT-4o provide many information tips and code helps for the Rust reconstruction process. The main project can complete Rust transformation within 20 days, which is inseparable from the assistance of the big model.
Projects that were used by the old version
- In version 6.0, opentype.js is the second parsing engine of this project, which mainly deals with feature relationship judgment and text conversion into SVG tasks, and gives us a lot of support in rendering.
- In version 6.0, @napi-rs/ttf2woff2 enables the Nodejs platform and the Bun platform to compress font files at extremely fast native speeds, which is extremely efficient and extremely fast.
- In version 6.0, the wowoff2 project compiles Google's woff2 format conversion function code into wasm, providing a very simple API for our font compression. However, the export method of the wowoff2 project is to embed wasm by js, which greatly affects the packaging and use of js, so the project is also rebuilt and released a suitable version.
- In version 6.0, multi-threading adopts workerpool's solution, and with the support of multi-threading, the speed is much faster.
Open Source License
Apache-2.0