feat(gui): M3 - TrueType rasterizer with fontconfig font discovery

Replace the M2 stub rasterizer with a real font rasterizer:

- build.zig.zon: add TrueType as a lazy path dependency
- build.zig: swap stub_rasterizer_mod for truetype_rasterizer_mod; link
  fontconfig + libc on Linux; TrueType dep is lazy (falls back gracefully)
- src/gui/rasterizer/truetype.zig: andrewrk/TrueType rasterizer; loadFont
  uses fontconfig to locate the font file, derives cell dimensions from
  vertical metrics (ascent−descent) and 'M' advance width; render blits the
  A8 glyph bitmap into the caller-provided staging buffer with correct
  baseline placement (ascent_px + off_y) and double-wide support (+cell_w
  x-offset for kind=.right); arena allocator per render call
- src/gui/rasterizer/font_finder.zig: OS dispatcher (Linux only for now)
- src/gui/rasterizer/font_finder/linux.zig: fontconfig C API - FcFontMatch
  resolves a font name pattern to an absolute file path

Requires: libfontconfig-dev  (already present alongside libgl-dev etc.)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
CJ van den Berg 2026-03-29 19:20:06 +02:00
parent 39b482b2e0
commit ae0f62c3bf
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
5 changed files with 173 additions and 3 deletions

View file

@ -50,6 +50,10 @@
.path = "../flow-deps/sokol-zig",
.lazy = true,
},
.TrueType = .{
.path = "../flow-deps/TrueType",
.lazy = true,
},
.diffz = .{
.url = "git+https://github.com/ziglibs/diffz.git#fbdf690b87db6b1142bbce6d4906f90b09ce60bb",
.hash = "diffz-0.0.1-G2tlIezMAQBwGNGDs7Hn_N25dWSjEzgR_FAx9GFAvCuZ",