Expand description
Layout generators: box trees laid out by CSS flexbox and grid with the engine’s fonts.
A layout is resolved where text is prepared, so its text is measured and drawn by the
same code. It is resolved in render pixels and rounded to whole pixels. A text node
breaks its lines at its unrounded content width plus LAYOUT_WRAP_SLACK, both when
measured and when drawn.
Structs§
- Layout
Bounds - Where a layout’s nodes lie (
measure_layout), in preorder. - Node
Bounds - Where one layout node’s boxes lie, before its clip’s transform and node visuals.
- Node
Rects - One node’s boxes in render pixels,
[left, top, right, bottom], whole pixels from the picture’s top-left. - Resolved
Layout - Every node’s boxes, in preorder (
resolve).
Constants§
- LAYOUT_
WRAP_ SLACK - Pixels added to a text node’s wrapping width so float summation order cannot re-break a text sized to its own max-content width. Lines and heights may overflow the box by less than this.
Functions§
- fit_
texts - Fits the font size of each text node with a
font_size_fitto its content box inresolved(resolve), with lines fromshape, and updates its font size, lines and overflow. The boxes keep the sizes they were laid out at. - layout_
texts - Each text node’s store key in preorder (
Nonefor empty text), and each distinct key’s raster request at its font size inresolved, wrapped at its unrounded content width plus the slack and clamped in its content height plus the slack. - measure_
layout - Where each node of a valid layout tree lies on a picture of
sizeat picture timetime, laid out withrasterizer’s fonts exactly as a frame is. - resolve
- Lays
layoutout on a picture ofsizepixels.shapedholds each text node’s shaped text in preorder,Nonefor empty text. - shape_
texts - Shapes each text node’s text in preorder with
shapeon a picture ofsize, asresolvelays them out.