pub struct LayoutLine {
pub items: Vec<LineItem>,
pub width: f64,
pub ascent: f64,
pub descent: f64,
pub line_gap: f64,
pub height: f64,
pub indent_left: f64,
pub available_width: f64,
pub is_last: bool,
pub forced_break_after: Option<ForcedBreakKind>,
}Expand description
A laid-out line within a paragraph.
Fields§
§items: Vec<LineItem>§width: f64Total content width of the line.
Spaces that end a line hang past its end, so they can take this past
available_width. See LayoutLine::hanging_space_counts.
ascent: f64Maximum ascent on this line (above baseline).
descent: f64Maximum descent on this line (below baseline).
line_gap: f64Effective leading needed to preserve the tallest run’s natural advance.
height: f64Total line height.
indent_left: f64Left indent for this line.
available_width: f64Available width this line was laid out against.
is_last: boolWhether this is the last line of the paragraph.
forced_break_after: Option<ForcedBreakKind>The explicit break that ended this line, when present.
Implementations§
Source§impl LayoutLine
impl LayoutLine
Sourcepub fn baseline_offset(&self) -> f64
pub fn baseline_offset(&self) -> f64
Distance from the line-box top to its text baseline.
Sourcepub fn hanging_space_counts(&self) -> (usize, usize)
pub fn hanging_space_counts(&self) -> (usize, usize)
How many items at the visual start and at the visual end of the line are spaces that end it logically.
Those spaces hang past the line end, which is its visual right in left-to-right text and its visual left in right-to-left text. Alignment leaves them out of the width, and they may pass the available width.
Plain text is never reordered, so its spaces hang at the visual end, after an item that is not a space. Line breaking gives the spaces that end a plain line an item of their own.