Expand description
Text overlay (§6) GPU pipeline.
Renders MILK_MSG.INI message strings as 2D glyph quads atop the
comp output. Glyphs are rasterised on-demand by ab_glyph into a
shared Rgba8Unorm atlas (alpha stored in .r), and the pipeline
emits one draw per frame from a dynamic vertex buffer holding every
glyph of every active message.
Two bundled fonts come from epaint_default_fonts:
- 0 (default):
Ubuntu-Light— clean sans the MD2 default message font (Arial) maps to. - 1 (mono):
Hack-Regular— covers presets that ask for a monospace face. Mapping ignores bold/italic; MD2 only exposes those asfont=...; bold=1toggles and most preset packs author for the default sans anyway.
The atlas grows append-only inside a fixed 1024×1024 texture; if
a glyph doesn’t fit, the renderer falls back to the existing slot
pool (logged once). 1024² is enough for a few thousand glyphs at
32 px body size — well above what MILK_MSG.INI files use in the
wild (≤ 8 messages).
Structs§
- Glyph
Key 🔒 - Cache key for one rasterised glyph.
- Glyph
Slot 🔒 - One rasterised glyph’s slot in the atlas.
- Text
Atlas - GPU + CPU text atlas. Owned by
TextPipeline. - Text
Frame - One message the engine asks the renderer to draw this frame. POD —
the text/layout/font lookup all happens host-side in
TextPipeline::record. - Text
Pipeline - Text GPU pipeline. One render pipeline + a growable vertex buffer.
- Text
Quad Vertex - Per-glyph vertex pushed to the GPU vertex buffer.
Constants§
- TEXT_
ATLAS_ SIZE - Atlas texture side (square). 1024² fits ~3K glyphs at 32px body —
well above typical
MILK_MSG.INIusage. The atlas grows append-only inside this footprint; once full, new glyph requests fall back to existing nearest-size slots.
Functions§
- bundled_
fonts 🔒 - Load the two bundled fonts:
Ubuntu-Light(index0) +Hack-Regular(index1). Failures collapse to a one-font vec so the pipeline always has something to lay out against; the dropped font logs once.