Skip to main content

Module linebox

Module linebox 

Source
Expand description

The line box model: how tall a line is and where its baseline sits.

Half-leading over font metrics: a face’s box is its ascent and descent, each widened by half the leading, where leading is what line_height adds over the face’s natural height (ascent + descent + line gap). The line gap splits across the two halves so a single-face line always measures exactly line_height × size.

The strut is the paragraph’s own box — the line’s minimum geometry, independent of the runs on it. Runs larger than the strut grow the line around the shared baseline; runs smaller never shrink it below the strut.

Units: points throughout — runs of different sizes share one baseline, and font units don’t commute across sizes.

Structs§

LineBox
One line’s vertical geometry, in points.
Strut
Vertical extents around a baseline, in points: a face’s box when computed for one font and size, the paragraph’s strut when computed for the paragraph’s own style.