pub struct TextLine {
pub runs: Vec<TextRun>,
pub bounds: Rect,
pub metrics: LineMetrics,
}Expand description
A text line — holds all TextRuns within one line.
Coordinate system (relative to the layout origin):
bounds.origin: the line’s position in the layout.runs[].glyphs[].x/y: offsets relative tobounds.origin.
Fields§
§runs: Vec<TextRun>All runs in this line.
bounds: RectThe line’s bounding box (relative to the layout origin).
This is the line box (equivalent to block_min/max, kept for compat).
metrics: LineMetricsInline font metrics (block-axis coords + cap / x).
Implementations§
Source§impl TextLine
impl TextLine
Sourcepub fn layout_bounds(&self) -> Rect
pub fn layout_bounds(&self) -> Rect
Layout bounds for this line: parley’s default line_height box,
i.e. row_top → row_top + line_height.
Sourcepub fn line_box_bounds(&self) -> Rect
pub fn line_box_bounds(&self) -> Rect
Line box bounds — block_min → block_max (half-leading included).
Identical to Self::layout_bounds in most cases; kept separate so the
two concepts stay distinct if parley changes its default.
Sourcepub fn logical_bounds(&self) -> Rect
pub fn logical_bounds(&self) -> Rect
Logical / content bounds — content_block_min → content_block_max.
This is the equivalent of Pango’s logical_rect: typographic ascent +
descent, without leading. Stable across text changes, but for CJK
the font’s ascent margin still makes it look top-heavy.
Sourcepub fn cap_bounds(&self) -> Rect
pub fn cap_bounds(&self) -> Rect
Cap bounds — baseline - cap_height → baseline.
Equivalent to CSS text-box-edge: cap alphabetic. Recommended for
visual vertical centering of digits / uppercase / CJK. Because
cap_height is a font-level constant, this box does not change
when the line’s text changes.
Falls back to Self::logical_bounds when cap_height is unavailable.