pub struct TextBlock {
pub spans: Vec<TextSpan>,
}Expand description
A block of text (grouped by reading order).
Fields§
§spans: Vec<TextSpan>Spans within this block, sorted by position.
Implementations§
Source§impl TextBlock
impl TextBlock
Sourcepub fn text(&self) -> String
pub fn text(&self) -> String
Concatenate all spans into a single string, in reading order.
Spans that are close together are joined without a separator; a space is inserted when the gap between spans exceeds half the average character width.
ANN[r17/TEX5] The spans are in the order the page draws them, left to
right, and for Arabic or Hebrew that is the reverse of the order they
are read in (#436, class R-H of #389). The assembled line therefore goes
through [crate::bidi::logical_order] before it is returned: a line
with no right-to-left character comes back untouched, and one that has
them comes back with each of its runs the way a reader would type it.
The spans themselves are left alone – they carry the geometry, and the
geometry is visual.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TextBlock
impl RefUnwindSafe for TextBlock
impl Send for TextBlock
impl Sync for TextBlock
impl Unpin for TextBlock
impl UnsafeUnpin for TextBlock
impl UnwindSafe for TextBlock
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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