pub(crate) struct TextRunSegment {
pub info: Arc<FontAndScriptInfo>,
pub byte_range: Range<usize>,
pub character_range: Range<usize>,
pub break_at_start: bool,
pub runs: Vec<Arc<ShapedTextSlice>>,
}Fields§
§info: Arc<FontAndScriptInfo>Information about the font and language used in this text run. This is produced by segmenting the inline formatting context’s text content by font, script, and bidi level.
byte_range: Range<usize>The range of bytes in the parent super::InlineFormattingContext’s text content.
character_range: Range<usize>The range of characters in the parent super::InlineFormattingContext’s text content.
break_at_start: boolWhether or not the linebreaker said that we should allow a line break at the start of this segment.
runs: Vec<Arc<ShapedTextSlice>>The shaped runs within this segment.
Implementations§
Source§impl TextRunSegment
impl TextRunSegment
fn new( info: Arc<FontAndScriptInfo>, byte_range: Range<usize>, character_range: Range<usize>, ) -> Self
Sourcefn is_compatible(
&self,
new_font: &Option<FontRef>,
new_script: Script,
new_bidi_level: Level,
) -> bool
fn is_compatible( &self, new_font: &Option<FontRef>, new_script: Script, new_bidi_level: Level, ) -> bool
Returns true if the new Font, Script and BiDi Level are compatible with this segment
or false otherwise.
Sourcefn update(
&mut self,
next_byte_index: usize,
next_character_index: usize,
new_script: Script,
)
fn update( &mut self, next_byte_index: usize, next_character_index: usize, new_script: Script, )
Update this segment to end at the given byte and character index. The update will only ever make the Script specific and will not change it otherwise.
fn layout_into_line_items( &self, text_run: &TextRun, soft_wrap_policy: SegmentStartSoftWrapPolicy, ifc: &mut InlineFormattingContextLayout<'_>, )
Sourcefn shape_text(
&mut self,
parent_style: &ComputedValues,
formatting_context_text: &str,
linebreaker: &mut LineBreaker,
old_text_run_item: Option<TextRunItem>,
)
fn shape_text( &mut self, parent_style: &ComputedValues, formatting_context_text: &str, linebreaker: &mut LineBreaker, old_text_run_item: Option<TextRunItem>, )
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.
fn is_compatible_with_old_shaping_result(&self, old_segment: &Self) -> bool
Trait Implementations§
Source§impl Clone for TextRunSegment
impl Clone for TextRunSegment
Source§fn clone(&self) -> TextRunSegment
fn clone(&self) -> TextRunSegment
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TextRunSegment
impl Debug for TextRunSegment
Source§impl MallocSizeOf for TextRunSegment
impl MallocSizeOf for TextRunSegment
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl Freeze for TextRunSegment
impl !RefUnwindSafe for TextRunSegment
impl Send for TextRunSegment
impl Sync for TextRunSegment
impl Unpin for TextRunSegment
impl UnsafeUnpin 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
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