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: AuA cache of the advance of the entire ShapedTextSlice.
character_count: Utf32CodeUnitsThe number of characters that correspond to the glyphs in this ShapedTextSlice
total_word_separators: usizeA 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: boolWhether or not the text that created this slice was entirely white space.
Implementations§
Source§impl ShapedTextSlice
impl ShapedTextSlice
Sourcepub fn glyph_count(&self) -> usize
pub fn glyph_count(&self) -> usize
Return the number of glyphs represented by this ShapedTextSlice.
Sourcepub fn character_count(&self) -> Utf32CodeUnits
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.
Sourcepub fn total_advance(&self) -> Au
pub fn total_advance(&self) -> Au
The total advance of the characters represented by this ShapedTextSlice.
Sourcepub fn total_word_separators(&self) -> usize
pub fn total_word_separators(&self) -> usize
The number of word separators in this ShapedTextSlice.
Sourcepub fn hanging_and_removable_word_separators(&self) -> usize
pub fn hanging_and_removable_word_separators(&self) -> usize
The number of word separators in the hanging and removable portion of this ShapedTextSlice.
Sourcepub fn all_removable(&self) -> bool
pub fn all_removable(&self) -> bool
Whether or not this ShapedTextSlice is composed of only removable characters.
Sourcepub fn has_non_hangable_non_removable_content(&self) -> bool
pub fn has_non_hangable_non_removable_content(&self) -> bool
Whether or not this ShapedTextSlice has any non-hangable and non-removable glyphs.
Sourcepub fn removable_advance(&self) -> Au
pub fn removable_advance(&self) -> Au
The advance of this ShapedTextSlice that is removable at the end of a line.
Sourcepub fn hangable_advance(&self) -> Au
pub fn hangable_advance(&self) -> Au
The advance of this ShapedTextSlice that is hangable at the end of a line.
Sourcepub fn all_white_space(&self) -> bool
pub fn all_white_space(&self) -> bool
Whether or not this ShapedTextSlice is entirely composed of white space.
Sourcepub fn glyphs(&self) -> impl DoubleEndedIterator<Item = GlyphInfo<'_>> + use<'_>
pub fn glyphs(&self) -> impl DoubleEndedIterator<Item = GlyphInfo<'_>> + use<'_>
An iterator over the glyphs represented by this ShapedTextSlice.
fn split_off_count(&mut self, trimmed_glyph_count: usize) -> Arc<Self> ⓘ
Sourcepub fn without_removable_white_space(&self) -> Arc<Self> ⓘ
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
impl Clone for ShapedTextSlice
Source§fn clone(&self) -> ShapedTextSlice
fn clone(&self) -> ShapedTextSlice
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ShapedTextSlice
impl Debug for ShapedTextSlice
Source§impl MallocSizeOf for ShapedTextSlice
impl MallocSizeOf for ShapedTextSlice
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl Freeze for ShapedTextSlice
impl RefUnwindSafe for ShapedTextSlice
impl Send for ShapedTextSlice
impl Sync for ShapedTextSlice
impl Unpin for ShapedTextSlice
impl UnsafeUnpin for ShapedTextSlice
impl UnwindSafe for ShapedTextSlice
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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