pub struct LineLayout<'a> { /* private fields */ }Expand description
The layout pass: one paragraph → lines that fit the measure.
Implementations§
Source§impl LineLayout<'_>
impl LineLayout<'_>
Source§impl<'a> LineLayout<'a>
impl<'a> LineLayout<'a>
Sourcepub fn new(registry: &'a FontRegistry) -> Self
pub fn new(registry: &'a FontRegistry) -> Self
A layout pass over the faces in registry.
Source§impl LineLayout<'_>
impl LineLayout<'_>
Sourcepub fn strut(&self, style: &ParagraphStyle) -> Strut
pub fn strut(&self, style: &ParagraphStyle) -> Strut
The paragraph’s strut: the minimum box every one of its lines occupies, whatever the runs on it.
Sourcepub fn line_box(&self, runs: &[ShapedRun], style: &ParagraphStyle) -> LineBox
pub fn line_box(&self, runs: &[ShapedRun], style: &ParagraphStyle) -> LineBox
The box one line occupies: the strut, grown by any run taller than it around the shared baseline.
Sourcepub fn layout(
&self,
inlines: &[Inline],
style: &ParagraphStyle,
measure: impl Into<Measure>,
options: LineBreakOptions,
) -> Vec<Line>
pub fn layout( &self, inlines: &[Inline], style: &ParagraphStyle, measure: impl Into<Measure>, options: LineBreakOptions, ) -> Vec<Line>
Breaks one paragraph into lines of at most measure_pt
points, every inline taking the block’s own style.
Sourcepub fn layout_styled(
&self,
inlines: &[Inline],
style: &ParagraphStyle,
styles: &dyn InlineStyles,
measure: &Measure,
options: LineBreakOptions,
opening: Opening,
) -> Vec<Line>
pub fn layout_styled( &self, inlines: &[Inline], style: &ParagraphStyle, styles: &dyn InlineStyles, measure: &Measure, options: LineBreakOptions, opening: Opening, ) -> Vec<Line>
The same, with the style tree answering for each inline and
opening saying what sets the line the paragraph opens on
apart from the rest of it.
Sourcepub fn layout_shaped(
&self,
inlines: &[Inline],
style: &ParagraphStyle,
styles: &dyn InlineStyles,
measure: &Measure,
options: LineBreakOptions,
opening: Opening,
) -> (Broken, Option<Shaped>)
pub fn layout_shaped( &self, inlines: &[Inline], style: &ParagraphStyle, styles: &dyn InlineStyles, measure: &Measure, options: LineBreakOptions, opening: Opening, ) -> (Broken, Option<Shaped>)
The same, handing back the shaped paragraph beside the lines.
A caller that can break this paragraph again keeps it.
LineLayout::rebreak sets the same text to a different
profile without shaping it twice.
Sourcepub fn rebreak(&self, shaped: &Shaped, measure: &Measure, from: usize) -> Broken
pub fn rebreak(&self, shaped: &Shaped, measure: &Measure, from: usize) -> Broken
Breaks a paragraph that was already shaped to measure,
starting from the end of the line from, which is 0 for the
whole of it.
The style over the opening line is not held to the text it covered before. The profile decides where the lines end. A line pinned to a width it no longer has runs past that width.
Auto Trait Implementations§
impl<'a> Freeze for LineLayout<'a>
impl<'a> RefUnwindSafe for LineLayout<'a>
impl<'a> Send for LineLayout<'a>
impl<'a> Sync for LineLayout<'a>
impl<'a> Unpin for LineLayout<'a>
impl<'a> UnsafeUnpin for LineLayout<'a>
impl<'a> UnwindSafe for LineLayout<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.