Struct layout_2020::flow::inline::text_run::TextRunSegment
source · pub(crate) struct TextRunSegment {
pub font_index: usize,
pub script: Script,
pub bidi_level: Level,
pub range: Range<usize>,
pub break_at_start: bool,
pub runs: Vec<GlyphRun>,
}
Fields§
§font_index: usize
The index of this font in the parent super::InlineFormattingContext
’s collection of font
information.
script: Script
The Script
of this segment.
bidi_level: Level
The bidi Level of this segment.
range: Range<usize>
The range of bytes in the parent super::InlineFormattingContext
’s text content.
break_at_start: bool
Whether or not the linebreaker said that we should allow a line break at the start of this segment.
runs: Vec<GlyphRun>
The shaped runs within this segment.
Implementations§
source§impl TextRunSegment
impl TextRunSegment
fn new( font_index: usize, script: Script, bidi_level: Level, start_offset: usize, ) -> Self
sourcefn update_if_compatible(
&mut self,
new_font: &FontRef,
script: Script,
bidi_level: Level,
fonts: &[FontKeyAndMetrics],
font_context: &FontContext,
) -> bool
fn update_if_compatible( &mut self, new_font: &FontRef, script: Script, bidi_level: Level, fonts: &[FontKeyAndMetrics], font_context: &FontContext, ) -> bool
Update this segment if the Font and Script are compatible. The update will only ever make the Script specific. Returns true if the new Font and Script are compatible with this segment or false otherwise.
fn layout_into_line_items( &self, text_run: &TextRun, soft_wrap_policy: SegmentStartSoftWrapPolicy, ifc: &mut InlineFormattingContextLayout<'_>, )
fn shape_and_push_range( &mut self, range: &Range<usize>, formatting_context_text: &str, segment_font: &FontRef, options: &ShapingOptions, )
sourcefn shape_text(
&mut self,
parent_style: &ComputedValues,
formatting_context_text: &str,
linebreaker: &mut LineBreaker,
shaping_options: &ShapingOptions,
font: FontRef,
)
fn shape_text( &mut self, parent_style: &ComputedValues, formatting_context_text: &str, linebreaker: &mut LineBreaker, shaping_options: &ShapingOptions, font: FontRef, )
Shape the text of this TextRunSegment
, first finding “words” for the shaper by processing
the linebreaks found in the owning super::InlineFormattingContext
. Linebreaks are filtered,
based on the style of the parent inline box.
Trait Implementations§
source§impl Debug for TextRunSegment
impl Debug for TextRunSegment
Auto Trait Implementations§
impl Freeze for TextRunSegment
impl RefUnwindSafe for TextRunSegment
impl Send for TextRunSegment
impl Sync for TextRunSegment
impl Unpin for TextRunSegment
impl UnwindSafe for TextRunSegment
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