Show HN: TTF-DOOM – A raycaster running inside TrueType font hinting

Overview
A developer has squeezed a DOOM-style raycaster into the ancient VM that ships inside TrueType fonts. It has been reported that TrueType hinting is Turing-complete — and here’s the proof-of-concept: a 6.5 KB .ttf contains a DDA raycasting engine written entirely in TrueType bytecode. JavaScript handles movement, enemies and shooting, then passes coordinates into the font via font-variation-settings; the font does the raycasting and repositions glyph contours to render walls. Playable in Chrome or Edge — WASD to move, arrows to turn, Space to shoot. Wild, right?
Inside the font
The project compiles a small DSL (it looks a lot like stripped-down C) into TrueType FDEF/CALL bytecode and injects sin/cos tables and map data into the .ttf. The author allegedly lost days wrestling with TrueType’s fixed-point arithmetic — MUL does (a*b)/64, DIV behaves oddly — so loops are recursive FDEFs and the FreeType stack limit forces tight hacks. SCFS takes pixel coordinates, not font units; Chrome allegedly caches hinted glyphs and sometimes skips re-hinting when axes change, which required per-frame jitter to force updates. It’s both clever and a headache. The result: the glyph “A” becomes 16 vertical bars that the hinting VM moves to form a 3D perspective each frame.
Why it matters (and how to try it)
This isn’t just a party trick. It’s a reminder that decades-old, obscure parts of our toolchain can be reimagined as compute platforms — think llama.ttf but without a WASM shim; this runs in the original 1991 TrueType VM. The repo (github.com/4RH1T3CT0R7/ttf-doom) includes the compiler, font builder, game demo and tests; build scripts and a browser host get you running locally in seconds. It’s playful, nerdy, and a neat exploration of constraints: small code, strange primitives, maximal creativity. Want to poke at the weirdest VM you own? Here’s your chance.
Sources: github.com/4rh1t3ct0r7, Hacker News
Comments