pub struct Layout<B: Brush> { /* private fields */ }Expand description
Text layout.
Implementations§
Source§impl<B: Brush> Layout<B>
impl<B: Brush> Layout<B>
Sourcepub fn full_width(&self) -> f32
pub fn full_width(&self) -> f32
Returns the width of the layout, including the width of any trailing whitespace.
Sourcepub fn calculate_content_widths(&self) -> ContentWidths
pub fn calculate_content_widths(&self) -> ContentWidths
Calculates the lower and upper bounds on the width of the layout. These are recalculated every time this method is called.
This method currently may not return the correct results for mixed-direction text.
Sourcepub fn get(&self, index: usize) -> Option<Line<'_, B>>
pub fn get(&self, index: usize) -> Option<Line<'_, B>>
Returns the line at the specified index.
Returns None if the index is out of bounds, i.e. if it’s
not less than self.len().
Sourcepub fn is_rtl(&self) -> bool
pub fn is_rtl(&self) -> bool
Returns true if the dominant direction of the layout is right-to-left.
pub fn inline_boxes(&self) -> &[InlineBox]
pub fn inline_boxes_mut(&mut self) -> &mut [InlineBox]
Sourcepub fn lines(&self) -> impl Iterator<Item = Line<'_, B>> + '_ + Clone
pub fn lines(&self) -> impl Iterator<Item = Line<'_, B>> + '_ + Clone
Returns an iterator over the lines in the layout.
Sourcepub fn break_lines(&mut self) -> BreakLines<'_, B>
pub fn break_lines(&mut self) -> BreakLines<'_, B>
Returns line breaker to compute lines for the layout.
Sourcepub fn break_all_lines(&mut self, max_advance: Option<f32>)
pub fn break_all_lines(&mut self, max_advance: Option<f32>)
Breaks all lines with the specified maximum advance.
Sourcepub fn align(
&mut self,
container_width: Option<f32>,
alignment: Alignment,
options: AlignmentOptions,
)
pub fn align( &mut self, container_width: Option<f32>, alignment: Alignment, options: AlignmentOptions, )
Apply alignment to the layout relative to the specified container width or full layout width.
You must perform line breaking prior to aligning, through Layout::break_lines or
Layout::break_all_lines. If container_width is not specified, the layout’s
Layout::width is used.