Project 05 · FONT RASTERIZER
Tessera
A TrueType font parser and scanline rasterizer with analytic anti-aliasing. It renders every glyph in Ridge OS.
The challenge
Ridge OS needed text. Tessera turns font files into crisp, anti-aliased pixels with no font library involved.
The approach
The parser reads the TrueType tables directly. Curves are flattened into line segments, and a scanline rasterizer computes exact pixel coverage for smooth edges at any size.
The layers
Every subsystem, with the code it took and the time it took to write.
01
TrueType tables
3,240 lines3 weeks
02
Bézier flattening
1,180 lines1 week
03
Scanline rasterizer
4,700 lines4 weeks
From the source
Flattening a quadratic curve into segments
tessera/raster.c
// flatten a quadratic Bézier into line segments
static void flatten_quad(Path *p, V2 a, V2 b, V2 c) {
float d = v2_len(v2_sub(v2_add(a, c), v2_scale(b, 2)));
int n = 1 + (int)sqrtf(d * 4.0f);
for (int i = 1; i <= n; i++) {
float t = (float)i / n, u = 1 - t;
path_line_to(p, v2_add3(v2_scale(a, u*u),
v2_scale(b, 2*u*t), v2_scale(c, t*t)));
}
}
Jul 2026
Glyph outlines parsed and drawn as wireframes
Aug 2026
Anti-aliased rendering at any size
Aug 2026
Integrated into the Ridge OS compositor