Skip to main content

ShapedTextSlice

Struct ShapedTextSlice 

Source
pub struct ShapedTextSlice {
    shaped_text: Arc<ShapedText>,
    glyph_range: Range<usize>,
    total_advance: Au,
    character_count: Utf32CodeUnits,
    total_word_separators: usize,
    trailing_white_space: TrailingWhiteSpace<GlyphCountAndAdvance>,
    all_white_space: bool,
}
Expand description

A slice of a ShapedText which allows having different views into a shaped text run. This is used for splitting up shaped text during layout, without duplicating the entire run.

Fields§

§shaped_text: Arc<ShapedText>

The ShapedText that this ShapedTextSlice refers to.

§glyph_range: Range<usize>

The range of glyphs within the ShapedText that this ShapedTextSlice represents.

§total_advance: Au

A cache of the advance of the entire ShapedTextSlice.

§character_count: Utf32CodeUnits

The number of characters that correspond to the glyphs in this ShapedTextSlice

§total_word_separators: usize

A precomputed count of the number of word separators in the entire ShapedTextSlice. See https://drafts.csswg.org/css-text/#word-separator.

§trailing_white_space: TrailingWhiteSpace<GlyphCountAndAdvance>

The number of glyphs and their advance of the trailing white space portion of this slice during inline line layout.

§all_white_space: bool

Whether or not the text that created this slice was entirely white space.

Implementations§

Source§

impl ShapedTextSlice

Source

pub fn glyph_count(&self) -> usize

Return the number of glyphs represented by this ShapedTextSlice.

Source

pub fn character_count(&self) -> Utf32CodeUnits

The number of characters that were consumed to produce this ShapedTextSlice. Some characters correspond to more than one glyph and some glyphs correspond to more than one character.

Source

pub fn total_advance(&self) -> Au

The total advance of the characters represented by this ShapedTextSlice.

Source

pub fn total_word_separators(&self) -> usize

The number of word separators in this ShapedTextSlice.

Source

pub fn hanging_and_removable_word_separators(&self) -> usize

The number of word separators in the hanging and removable portion of this ShapedTextSlice.

Source

pub fn all_removable(&self) -> bool

Whether or not this ShapedTextSlice is composed of only removable characters.

Source

pub fn has_non_hangable_non_removable_content(&self) -> bool

Whether or not this ShapedTextSlice has any non-hangable and non-removable glyphs.

Source

pub fn removable_advance(&self) -> Au

The advance of this ShapedTextSlice that is removable at the end of a line.

Source

pub fn hangable_advance(&self) -> Au

The advance of this ShapedTextSlice that is hangable at the end of a line.

Source

pub fn all_white_space(&self) -> bool

Whether or not this ShapedTextSlice is entirely composed of white space.

Source

pub fn glyphs(&self) -> impl DoubleEndedIterator<Item = GlyphInfo<'_>> + use<'_>

An iterator over the glyphs represented by this ShapedTextSlice.

Source

fn split_off_count(&mut self, trimmed_glyph_count: usize) -> Arc<Self> ⓘ

Source

pub fn without_removable_white_space(&self) -> Arc<Self> ⓘ

Produce a new ShapedTextSlice that includes all of the glyphs that self does except for the removable portion of the slice.

Trait Implementations§

Source§

impl Clone for ShapedTextSlice

Source§

fn clone(&self) -> ShapedTextSlice

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ShapedTextSlice

Source§

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

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

impl MallocSizeOf for ShapedTextSlice

Source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,