Skip to content

daegun 1.0.0

Choose a tag to compare

@zztaeha zztaeha released this 20 Aug 01:18
· 8 commits to main since this release

The first release.

daegun turns a font file and a string into positioned, rasterized glyphs. It parses TrueType and OpenType, shapes complex scripts, breaks and lays out lines, hints, rasterizes on the CPU or the GPU, and subsets a font down to the glyphs a page actually uses. One crate does all of it, and a C ABI sits alongside the Rust API rather than behind it.

[dependencies]
daegun = "1.0.0"

What it does

Outlines TrueType glyf, CFF, CFF2, and variable fonts on any number of axes
Color COLR v0 and v1 paint graphs, CPAL palettes, and sbix and CBDT bitmap strikes
Shaping GSUB and GPOS in full, Apple morx and kerx, and shapers for Arabic, Hebrew, Thai, Hangul, Khmer, Myanmar, nine Indic scripts and 84 more through the Universal Shaping Engine
Text Bidi, line breaking greedy or optimal, justification, vertical writing, math
Rasterizing CPU everywhere, and GPU through Metal on Apple platforms, Direct3D 11 and 12 on Windows, and Vulkan anywhere
And Subsetting to the glyphs a page uses, TrueType and CFF hinting, an autohinter, and collections

What holds it up

  • No dependencies at all, so the supply chain is the Rust compiler and nothing else.
  • Unsafe code is forbidden in every parser and in the shaper, enforced by the compiler rather than by discipline. An inner allow is a hard error. Only the GPU backends and the C layer opt back in, and they say so at the top of their own files.
  • Every call in the Rust API is reachable from C, and the build fails if that stops being true.
  • 500 mutated fonts on every build, each reproducible from its seed. The C round trip runs under AddressSanitizer and UndefinedBehaviorSanitizer.
  • unwrap and expect are linted against outside tests, and the library is built with panic = "abort", so it never unwinds into a caller.

One command runs all of it, along with the tests, clippy, the shader compilers, two cross-compiled Windows targets, and the minimum supported Rust version:

sh scripts/tools/perf/gate.sh

Documentation

Every public name in both APIs is written up at dg.calia.cc — 122 Rust methods, 33 Rust types, 420 C functions, 86 C types and 215 C constants, each with what it returns, what it does when it cannot, and the units it answers in.

benchmark.md carries every latency benchmark in the tree, with the machine and build they were measured on. SECURITY.md sets out the threat model.

MIT · Rust 1.97.1 or newer