Fontdue
A fast, no_std, pure-Rust TrueType and OpenType font rasterizer and layout tool.
Repository Health
Technical Analysis
Fontdue is a simple, no_std, pure-Rust TrueType (.ttf/.ttc) and OpenType (.otf) font rasterizer and layout tool. It focuses on making font interaction as fast as possible and is designed to have very low end-to-end latency for turning glyphs into bitmaps, positioning itself as a modern replacement for libraries like rusttype, ab_glyph, and glyph_brush.
Fontdue fully parses fonts on creation and stores the data in a convenient, lifetime-free format, trading some initial allocation for a much simpler and faster access API. It handles rasterization and naive text layout but deliberately leaves complex script shaping to dedicated engines. Parsing is built on ttf-parser, giving it broad TrueType and OpenType table support.
What You Get
- A pure-Rust, no_std font rasterizer for TrueType and OpenType fonts
- A simple rasterization API that returns glyph metrics and a coverage bitmap
- A naive text layout engine for positioning runs of styled glyphs
- Lifetime-free font structures that own their parsed data
- Broad TrueType/OpenType table support via ttf-parser, with optional rayon and hashbrown features
Common Use Cases
- Rendering text in a game engine or custom GUI toolkit
- Rasterizing glyphs to bitmaps for a software renderer or canvas
- Laying out latin text runs with wrapping for on-screen display
Under The Hood
Architecture - The core Font type in font.rs parses a font on construction and exposes rasterize methods that produce Metrics plus a coverage bitmap, backed by the scanline rasterizer in raster.rs and geometry helpers in math.rs. Layout lives separately in layout.rs via the Layout type, which accumulates styled TextStyle runs and emits positioned glyphs. Platform-specific SIMD-style helpers sit under src/platform, with font table parsing organized under src/table and Unicode handling under src/unicode.
Tech Stack - Written in pure Rust as a no_std crate depending on alloc. It uses ttf-parser for font table parsing (with opentype-layout and no-std-float features) and offers optional hashbrown and rayon dependencies behind feature flags for hashing and parallelism.
Code Quality - The project is mature and battle-tested with 280 commits and a dedicated dev/tests suite including baseline and letter-render tests, plus benchmark harnesses under dev. CI runs via GitHub Actions. It is largely a solo-maintained project, so feature velocity is modest, but rasterization correctness is guarded by rendering baseline tests.
API Design - The rasterization API is deliberately minimal and stable: Font::from_bytes then font.rasterize(char, size) returns everything needed to draw a glyph. The layout API is richer but explicitly described as immature and subject to change. Documentation on docs.rs, a live WebAssembly demo, and example programs under dev/examples make it approachable.