Expand description
Layout generators: box trees laid out by CSS flexbox and grid with the fonts the engine draws with.
A layout is resolved where text is prepared, which holds the fonts, so
its text is measured and drawn by the same code. It is resolved at the
render size, in render pixels, and rounded to whole pixels; a text node
breaks its lines at its unrounded content width plus
LAYOUT_WRAP_SLACK, when measured and when drawn alike.
Structs§
- Layout
Bounds - Where a layout’s nodes lie (
measure_layout), in preorder. - Node
Bounds - Where one layout node lies, before its clip’s transform and before node visuals: its layout boxes, not where it is drawn.
- Node
Rects - One node’s boxes in render pixels,
[left, top, right, bottom], whole pixels from the picture’s top-left corner. - Resolved
Layout - Every node’s boxes, in preorder (
resolve).
Constants§
- LAYOUT_
WRAP_ SLACK - What a text node’s wrapping width adds to its content width, in pixels: float summation order cannot then break a text sized to its own max-content width again. A line it lets through overflows its box by under this much, and a text taller than its box by under this much still fits it.
Functions§
- layout_
texts - Each text node’s store key in preorder (
Nonefor empty text), and each distinct key’s raster request: wrapped at its unrounded content width plus the slack, as it was measured. - measure_
layout - Where each node of a valid layout tree lies on a picture of
size, at picture timetime, laid out withrasterizer’s fonts as a frame lays it out.canvasis the project canvas, which the tree’s pixel lengths are pixels of (the picture’s own size when they are measured at it). Rects are before the clip’s transform and before node visuals: layout boxes, not where they are drawn. An invalid tree gives unspecified rects, but never panics. - resolve
- Lays
layoutout on a picture ofsizepixels.shapedholds each text node’s shaped text, in preorder,Nonefor an empty text. - shape_
texts - Each text node’s shaped text, in preorder, shaped by
shapeon a picture ofsize: whatresolvelays the texts out with.