Typst-Assets
Bundled fonts, ICU segmentation data, and HTML/MathML assets for the Typst compiler.
Repository Health
Technical Analysis
Typst-Assets is a Rust crate that packages the static assets the Typst typesetting compiler depends on, kept in a separate crate to keep the main compiler’s source size down. It bundles default fonts (behind a fonts feature), custom ICU line- and grapheme-segmentation data, and HTML/MathML lookup tables.
By exposing these assets through simple byte-slice accessors, the crate lets the Typst compiler and downstream embedders load fonts and Unicode data without vendoring large binary blobs directly into application code.
What You Get
- Bundled default fonts for Typst behind an opt-in
fontscargo feature - Custom ICU segmentation data that fixes CJK line-breaking around curly quotes
- HTML and MathML asset tables used during document export
- Simple byte-slice accessors so embedders avoid vendoring binary blobs themselves
Common Use Cases
- Providing default fonts and Unicode data to the Typst compiler
- Embedding Typst in a Rust application that needs the standard asset set
- Loading ICU segmentation blobs for correct CJK line breaking
Under The Hood
Architecture - The crate is intentionally minimal: src/lib.rs defines an asset! macro wrapping include_bytes!(concat!("../files/", $path)) and organizes assets into modules (icu, html, mathml) plus an optional fonts module gated by a cargo feature. A companion codegen workspace member generates some of the table data under files/.
Tech Stack - Rust (edition 2024) built with Cargo. Its only runtime dependency is bitflags; the heavy lifting is static binary data embedded at compile time. ICU data is produced with a patched icu4x-datagen toolchain as documented in the source.
Code Quality - The code is small, documented, and single-purpose, with clear inline notes explaining why the custom ICU segmentation blob exists and how to regenerate it. There is little logic to test since the crate is essentially a typed wrapper over embedded bytes.
API Design - The public surface is a handful of &[u8] accessors and feature flags, which is about as simple as an asset crate can be. Consumers opt into fonts via the fonts feature and reference assets by module path, requiring almost no boilerplate.