SB-004-FONT_SYSTEM.md (P0,
396 lines)
- Font loading, management subsystem for D3-TUI .d3f format
- Detailed binary D3F format: 24-byte header, 16-byte per-glyph
entries, texture data
- API:
d3tui_font_load, d3tui_font_load_mem,
d3tui_font_free, get_metrics, get_glyph, get_texture,
get_tex_coords
- Built-in default font: “D3TUI Default”, 16px, 8x16 cell, ASCII
32-126 + extended, 256x256 ARGB1555 atlas
- Font conversion tool (d3tui-fontconv) CLI with Python PIL
implementation provided
- Font cache with reference counting (prevents redundant loads)
- Font fallback chain: try next font → replacement char (□) →
skip
- Performance: loading < 50ms, each font < 512KB, glyph lookup
< 1μs