pub(crate) struct TextRun {
pub base_fragment_info: BaseFragmentInfo,
pub parent_style: Arc<ComputedValues>,
pub text_range: Range<usize>,
pub shaped_text: Vec<TextRunSegment>,
}
Expand description
Fields§
§base_fragment_info: BaseFragmentInfo
§parent_style: Arc<ComputedValues>
§text_range: Range<usize>
§shaped_text: Vec<TextRunSegment>
The text of this TextRun
with a font selected, broken into unbreakable
segments, and shaped.
Implementations§
source§impl TextRun
impl TextRun
pub(crate) fn new( base_fragment_info: BaseFragmentInfo, parent_style: Arc<ComputedValues>, text_range: Range<usize>, ) -> Self
pub(super) fn segment_and_shape( &mut self, formatting_context_text: &str, font_context: &FontContext, linebreaker: &mut LineBreaker, font_cache: &mut Vec<FontKeyAndMetrics>, bidi_info: &BidiInfo<'_>, )
sourcefn segment_text_by_font(
&mut self,
formatting_context_text: &str,
font_context: &FontContext,
font_cache: &mut Vec<FontKeyAndMetrics>,
bidi_info: &BidiInfo<'_>,
) -> Vec<(TextRunSegment, FontRef)>
fn segment_text_by_font( &mut self, formatting_context_text: &str, font_context: &FontContext, font_cache: &mut Vec<FontKeyAndMetrics>, bidi_info: &BidiInfo<'_>, ) -> Vec<(TextRunSegment, FontRef)>
Take the TextRun
’s text and turn it into TextRunSegment
s. Each segment has a matched
font and script. Fonts may differ when glyphs are found in fallback fonts. Fonts are stored
in the font_cache
which is a cache of all font keys and metrics used in this
super::InlineFormattingContext
.
pub(super) fn layout_into_line_items( &self, ifc: &mut InlineFormattingContextLayout<'_>, )
Trait Implementations§
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
Mutably borrows from an owned value. Read more
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>
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 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>
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 moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert