Skip to main content

LineLayout

Struct LineLayout 

Source
pub struct LineLayout<'a> { /* private fields */ }
Expand description

The layout pass: one paragraph → lines that fit the measure.

Implementations§

Source§

impl LineLayout<'_>

Source

pub fn shape( &self, text: &str, style: &ParagraphStyle, ) -> Option<Vec<ShapedRun>>

One string as shaped runs, set the way style asks for it. The counterpart of layout for text that is not broken into lines: page furniture, an ornament, an initial letter.

Source§

impl<'a> LineLayout<'a>

Source

pub fn new(registry: &'a FontRegistry) -> Self

A layout pass over the faces in registry.

Source§

impl LineLayout<'_>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Finish for T

§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

§

fn to_owned_table(&self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.