Skip to main content

Module text

Module text 

Source
Expand description

On-canvas text via glyphon (ADR-0009), behind the non-default text feature.

A small, reusable seam: the frontend queues a list of positioned TextRuns each frame; TextLayer shapes them and draws them in a second render pass that loads (does not clear) the scene, so text composites over the visual in the same frame. It lives in core — not the standalone — because that is where the wgpu device/queue/surface live (ADR-0001: the frontend never sees a backend); the text feature, not a crate boundary, keeps it out of the plugin/default build. First consumer is Plan 0008’s browse overlay; Plan 0009’s HUD reuses the same seam rather than a throwaway.

Structs§

TextLayer
Owns glyphon’s font/atlas/renderer state plus a reusable buffer pool, and the per-frame queue of runs and panels. One instance per super::Renderer, and one per secondary surface.
TextMeasure
The width a run of text lays out to, shaped exactly as TextLayer draws it: the system sans-serif family, advanced shaping, one line.
TextRun
A single positioned run of text the frontend queues for the current frame. Coordinates are top-left device pixels (matching the diagnostics overlay); color is linear RGBA in 0.0..=1.0. The public seam the overlay and a later HUD both fill.

Constants§

LINE_HEIGHT_RATIO
Line height as a multiple of the font size. Runs are single-line, so this only sets vertical extent, never wrapping.

Functions§

fit_width
text shortened to fit max_width as width measures it, ending in ... when it had to cut.