pub struct ShapedTextSlice {
shaped_text: Arc<ShapedText>,
glyph_range: Range<usize>,
total_advance: Au,
character_count: usize,
total_word_separators: usize,
is_whitespace: bool,
ends_with_whitespace: 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: usizeThe 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.
is_whitespace: boolWhether or not this ShapedTextSlice is entirely whitespace.
ends_with_whitespace: boolWhether or not this ShapedTextSlice ends with whitespace glyphs.
Typically whitespace glyphs are placed in a separate slice,
but that may not be the case with white-space: break-spaces.
Implementations§
Source§impl ShapedTextSlice
impl ShapedTextSlice
Sourcepub fn shaped_text(&self) -> Arc<ShapedText>
pub fn shaped_text(&self) -> Arc<ShapedText>
Return the ShapedText that backs this 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) -> usize
pub fn character_count(&self) -> usize
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 is_whitespace(&self) -> bool
pub fn is_whitespace(&self) -> bool
Whether or not this ShapedTextSlice is entirely whitespace.
Sourcepub fn ends_with_whitespace(&self) -> bool
pub fn ends_with_whitespace(&self) -> bool
Whether or not this ShapedTextSlice ends with whitespace.
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.
Trait Implementations§
Source§impl Clone for ShapedTextSlice
impl Clone for ShapedTextSlice
Source§fn clone(&self) -> ShapedTextSlice
fn clone(&self) -> ShapedTextSlice
1.0.0 · 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<'de> Deserialize<'de> for ShapedTextSlice
impl<'de> Deserialize<'de> for ShapedTextSlice
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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