Skip to main content

WrappedLineLayout

Struct WrappedLineLayout 

Source
pub struct WrappedLineLayout {
    pub unwrapped_layout: Arc<LineLayout>,
    pub wrap_boundaries: SmallVec<[WrapBoundary; 1]>,
    pub wrap_width: Option<Pixels>,
}
Expand description

A line of text that has been wrapped to fit a given width.

Fields§

§unwrapped_layout: Arc<LineLayout>

The line layout, pre-wrapping.

§wrap_boundaries: SmallVec<[WrapBoundary; 1]>

The boundaries at which the line was wrapped.

§wrap_width: Option<Pixels>

The width of the line, if it was wrapped.

Implementations§

Source§

impl WrappedLineLayout

Source

pub fn len(&self) -> usize

The length of the underlying text, in utf8 bytes.

Source

pub fn width(&self) -> Pixels

The width of this line, in pixels, whether or not it was wrapped.

Source

pub fn size(&self, line_height: Pixels) -> Size<Pixels>

The size of the whole wrapped text, for the given line_height. can span multiple lines if there are multiple wrap boundaries.

Source

pub fn ascent(&self) -> Pixels

The ascent of a line in this layout

Source

pub fn descent(&self) -> Pixels

The descent of a line in this layout

Source

pub fn wrap_boundaries(&self) -> &[WrapBoundary]

The wrap boundaries in this layout

Source

pub fn font_size(&self) -> Pixels

The font size of this layout

Source

pub fn runs(&self) -> &[ShapedRun]

The runs in this layout, sans wrapping

Source

pub fn index_for_position( &self, position: Point<Pixels>, line_height: Pixels, ) -> Result<usize, usize>

The index corresponding to a given position in this layout for the given line height.

See also Self::closest_index_for_position.

Source

pub fn closest_index_for_position( &self, position: Point<Pixels>, line_height: Pixels, ) -> Result<usize, usize>

The closest index to a given position in this layout for the given line height.

Closest means the character boundary closest to the given position.

See also LineLayout::closest_index_for_x.

Source

pub fn position_for_index( &self, index: usize, line_height: Pixels, ) -> Option<Point<Pixels>>

Returns the pixel position for the given byte index.

Trait Implementations§

Source§

impl Debug for WrappedLineLayout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WrappedLineLayout

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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
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.

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.