pub(crate) struct ShapingQueue<'a> {
queue: Vec<ShapingQueueText>,
text: &'a str,
line_breaker: LineBreaker,
byte_range: Range<usize>,
character_range: Range<usize>,
resolved_script: Option<Script>,
}Expand description
The ShapingQueue is responsible for shaping text during inline formatting context
construction. It allows for shaping text across inline box boundaries. When pushing
items to the queue, if the items are compatible pieces of text that can be shaped
together, they are accumulated. The queue may be flushed in the given situations:
- An incompatible piece of text (different fonts or certain style properties) is pushed to the queue.
- A preserved newline or tab is pushed to the queue.
- An inline box breaks shaping via padding, border, margins or a non-
baselinevertical-alignproperty. - Atomic content in the inline formatting context
Upon flushing, the ShapingQueue will shape any pending text and assign the
resulting ShapedTextSlices to the originating TextRuns.
Fields§
§queue: Vec<ShapingQueueText>The queue of items in the current batch that will be shaped together.
text: &'a strThe text that will be used for shaping.
line_breaker: LineBreakerThe line breaker that will be used to slice shaping results across on line break boundaries.
byte_range: Range<usize>The byte range of the text to shape in Self::text for the current batch.
Only contiguous ranges can be shaped together.
character_range: Range<usize>The character range of the text to shape in Self::text for the current batch.
Only contiguous ranges can be shaped together.
resolved_script: Option<Script>The resolved script for the current batch. This is used to gradually turn non-specific scripts into a resolved value for shaping.
Implementations§
Source§impl<'a> ShapingQueue<'a>
impl<'a> ShapingQueue<'a>
pub(crate) fn new(text: &'a str, line_break_options: LineBreakOptions) -> Self
fn compatible_old_shaping_result( &self, character_count: usize, ) -> Option<Arc<ShapedText>>
fn shape_batch(&self) -> Option<Arc<ShapedText>>
Sourcepub(crate) fn flush(&mut self)
pub(crate) fn flush(&mut self)
Flush this ShapingQueue. If any content had been collected up to this point,
it will be shaped and the resulting ShapedTextSlices will be assigned to their
originating TextRuns.
fn compatible_with_batch(&self, text: &ShapingQueueText) -> bool
fn push_text(&mut self, text: ShapingQueueText)
Sourcepub(crate) fn push(&mut self, entry: ShapingQueueEntry)
pub(crate) fn push(&mut self, entry: ShapingQueueEntry)
Push a new ShapingQueueEntry on to this ShapingQueue, maybe flushing
previously collected entries.
Auto Trait Implementations§
impl<'a> Freeze for ShapingQueue<'a>
impl<'a> !RefUnwindSafe for ShapingQueue<'a>
impl<'a> Send for ShapingQueue<'a>
impl<'a> Sync for ShapingQueue<'a>
impl<'a> Unpin for ShapingQueue<'a>
impl<'a> UnsafeUnpin for ShapingQueue<'a>
impl<'a> !UnwindSafe for ShapingQueue<'a>
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> 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