Real fonts in the wasm compositor: the host rasterises glyphs (Allo Variable, Adwaita Mono)
CI / test (push) Failing after 27s

New moonplasma:host/font import (load a TTF into a slot, rasterise a glyph). compositor/font now
shares its loading/caching/install logic and has two backends: stb_truetype through C (native) and
the host import (wasm). The Rust host draws glyphs with ab_glyph's outlines on an integer pixel grid,
using stb_truetype's em-size scaling, so text matches the native build.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Sonnet 5.5 committed 2026-11-25 01:50:01 -08:00
1 parent 0b9af11232
commit 5c3bebc7fd
15 files changed
+408 -143

No files matched your search

+20
View File
@@ -52,9 +52,29 @@ interface sys {
spawn: func(cmd: string, display: string) -> bool;
}
/// Glyph rasterisation. The component has no C rasteriser, so the host draws glyphs from TTF files
/// it loads (mirrors compositor/font's native backend: sizes are em sizes in pixels).
interface font {
/// Load the TTF file at `path` into `slot` (0..3). False when it can't be read or parsed.
load: func(slot: u32, path: string) -> bool;
/// One rendered glyph: an 8-bit coverage bitmap `width` x `height`, whose top-left sits at
/// (`xoff`, `yoff`) from the pen on the baseline (y grows downward), and the pen advance.
record glyph {
width: s32,
height: s32,
xoff: s32,
yoff: s32,
advance: s32,
coverage: list<u8>,
}
rasterise: func(slot: u32, codepoint: u32, size: u32) -> glyph;
}
/// The compositor as one component: it imports the OS surface and exports its entry point.
world compositor {
import sys;
import font;
/// Run the compositor until it exits. `args` are the command-line arguments (without argv[0]).
export run: func(args: list<string>) -> s32;
}