Typst-Assets

Bundled fonts, ICU segmentation data, and HTML/MathML assets for the Typst compiler.

Library
Cargo
v0.15.1
17stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
49/100Fair
Development Activity52
Maintenance64
Community20
Maturity48
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
77/100Good
Architecture80
Code Quality78
Innovation60
Learning Curve88

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 fonts cargo 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.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search