Expand description
The text engine: shaping, line breaking and glyph outlines, with no toolkit and no browser under them.
TextLayout is the one thing a drawing
cannot do for itself, and the trait says it is the host’s engine — so a
host that has none, and an exporter run without one, need this: the
Shaper lays a run out from the typeface’s own bytes, and Outlines
traces the glyphs it placed. Both are stated in the same metrics, so the
ink lands where the layout said it would.
Modules§
- cache 🔒
- The layout cache. Every label on a sheet is laid out on every frame, and the text it is laid out from rarely changes, so a run is shaped once.
- metrics 🔒
- The vertical metrics a row is measured by, in font units.
- outline 🔒
- Glyph outlines: the ink behind a laid-out glyph, in font units.
- rows 🔒
- Breaking a shaped paragraph into rows.
- shaper 🔒
Shaper: a text engine of our own, so a host without one can still be told where every glyph lands.
Structs§
- Font
Point - A point of a glyph outline: font units, Y up, as the face states it.
- Metrics
- A face’s vertical metrics, in font units — the size-independent numbers a row’s height and a glyph’s baseline are derived from.
- Outlines
- A face’s outlines, traced on demand and kept: a label redrawn every frame traces its glyphs once.
- Shaper
- One typeface, shaped by
harfrustand broken into rows by the desktop engine’s rules — the whole of whatTextLayoutasks of a host, with no toolkit under it.
Enums§
- Path
Command - One step of a glyph’s outline. The vocabulary a face’s contours are made
of, which a consumer renders into its own path type — an SVG
d, aPath2D.