Expand description
Text rendering — font loading, shaping, and glyph rasterization.
§Pipeline
Font bytes (TTF/OTF)
│ ttf-parser → glyph outline curves
│ rustybuzz → shaped glyph positions & advances
│
GlyphPathBuilder → AGG PathStorage (Bézier curves)
│
rasterize_fill_path → Framebuffer pixels§Coordinate system
TrueType fonts use Y-up coordinates (positive Y = above baseline). This matches GfxCtx’s first-quadrant convention exactly — no Y-flip is needed at the glyph boundary.
The baseline is placed at the Y coordinate passed to GfxCtx::fill_text.
Ascenders go to higher Y values (up), descenders to lower Y values (down),
which is correct for Y-up rendering.
Structs§
- Font
- A loaded font, ready for shaping and rasterization.
- Shaped
Glyph - Position and identity of one shaped glyph, without any rendering.
- Text
Metrics - Metrics describing a single line of shaped text.
Functions§
- flatten_
glyph_ at_ origin - Flatten a single glyph’s outline using AGG
ConvCurve, with the glyph origin at (0, 0) in pixel space. - measure_
advance - Measure text advance width without rasterizing.
- measure_
text_ metrics - Measure full text metrics (width, ascent, descent, line_height).
- shape_
and_ flatten_ text - Shape
textand return all glyph contours flattened to polylines. - shape_
and_ flatten_ text_ via_ agg - Shape
textand return glyph contours flattened by AGG’s ownConvCurve, grouped per glyph. - shape_
glyphs - Shape
textand return per-glyph positioning info, with no outline extraction or tessellation.