Struct layout_2013::text_run::TextRun
source · pub struct TextRun {
pub text: Arc<String>,
pub pt_size: Au,
pub font_metrics: FontMetrics,
pub font_key: FontInstanceKey,
pub glyphs: Arc<Vec<GlyphRun>>,
pub bidi_level: Level,
pub extra_word_spacing: Au,
}
Expand description
A single “paragraph” of text in one font size and style.
Fields§
§text: Arc<String>
The UTF-8 string represented by this text run.
pt_size: Au
§font_metrics: FontMetrics
§font_key: FontInstanceKey
§glyphs: Arc<Vec<GlyphRun>>
The glyph runs that make up this text run.
bidi_level: Level
§extra_word_spacing: Au
Implementations§
source§impl<'a> TextRun
impl<'a> TextRun
sourcepub fn new(
font: FontRef,
font_key: FontInstanceKey,
text: String,
options: &ShapingOptions,
bidi_level: Level,
breaker: &mut Option<LineBreakLeafIter>,
) -> (TextRun, bool)
pub fn new( font: FontRef, font_key: FontInstanceKey, text: String, options: &ShapingOptions, bidi_level: Level, breaker: &mut Option<LineBreakLeafIter>, ) -> (TextRun, bool)
Constructs a new text run. Also returns if there is a line break at the beginning
pub fn break_and_shape( font: FontRef, text: &str, options: &ShapingOptions, breaker: &mut Option<LineBreakLeafIter>, ) -> (Vec<GlyphRun>, bool)
pub fn ascent(&self) -> Au
pub fn advance_for_range(&self, range: &Range<ByteIndex>) -> Au
pub fn metrics_for_range(&self, range: &Range<ByteIndex>) -> RunMetrics
pub fn metrics_for_slice( &self, glyphs: &GlyphStore, slice_range: &Range<ByteIndex>, ) -> RunMetrics
pub fn min_width_for_range(&self, range: &Range<ByteIndex>) -> Au
pub fn minimum_splittable_inline_size(&self, range: &Range<ByteIndex>) -> Au
sourcefn index_of_first_glyph_run_containing(&self, index: ByteIndex) -> Option<usize>
fn index_of_first_glyph_run_containing(&self, index: ByteIndex) -> Option<usize>
Returns the index of the first glyph run containing the given character index.
pub fn on_glyph_run_boundary(&self, index: ByteIndex) -> bool
sourcepub fn range_index_of_advance(
&self,
range: &Range<ByteIndex>,
advance: Au,
) -> usize
pub fn range_index_of_advance( &self, range: &Range<ByteIndex>, advance: Au, ) -> usize
Returns the index in the range of the first glyph advancing over given advance
sourcepub fn natural_word_slices_in_range(
&'a self,
range: &Range<ByteIndex>,
) -> NaturalWordSliceIterator<'a> ⓘ
pub fn natural_word_slices_in_range( &'a self, range: &Range<ByteIndex>, ) -> NaturalWordSliceIterator<'a> ⓘ
Returns an iterator that will iterate over all slices of glyphs that represent natural words in the given range.
sourcepub fn natural_word_slices_in_visual_order(
&'a self,
range: &Range<ByteIndex>,
) -> NaturalWordSliceIterator<'a> ⓘ
pub fn natural_word_slices_in_visual_order( &'a self, range: &Range<ByteIndex>, ) -> NaturalWordSliceIterator<'a> ⓘ
Returns an iterator that over natural word slices in visual order (left to right or right to left, depending on the bidirectional embedding level).
sourcepub fn character_slices_in_range(
&'a self,
range: &Range<ByteIndex>,
) -> CharacterSliceIterator<'a> ⓘ
pub fn character_slices_in_range( &'a self, range: &Range<ByteIndex>, ) -> CharacterSliceIterator<'a> ⓘ
Returns an iterator that will iterate over all slices of glyphs that represent individual characters in the given range.
Trait Implementations§
source§impl<'de> Deserialize<'de> for TextRun
impl<'de> Deserialize<'de> for TextRun
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>,
Auto Trait Implementations§
impl Freeze for TextRun
impl RefUnwindSafe for TextRun
impl Send for TextRun
impl Sync for TextRun
impl Unpin for TextRun
impl UnwindSafe for TextRun
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> 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