pub struct BidiParagraph { /* private fields */ }Expand description
Result of paragraph-level bidi analysis.
Call BidiParagraph::new to analyse a string, then inspect
BidiParagraph::runs for the visual-order run sequence.
Implementations§
Source§impl BidiParagraph
impl BidiParagraph
Sourcepub fn new(text: &str, base_rtl: Option<bool>) -> Self
pub fn new(text: &str, base_rtl: Option<bool>) -> Self
Analyse a paragraph for bidi runs.
The base_rtl argument controls the paragraph base direction:
None— auto-detect via UAX #9 rules P2/P3 (recommended).Some(true)— force RTL base direction.Some(false)— force LTR base direction.
The returned runs are in visual order (as they would appear on screen), not logical order.
Sourcepub fn base_level(&self) -> u8
pub fn base_level(&self) -> u8
Returns the resolved paragraph base embedding level.
Sourcepub fn is_rtl(&self) -> bool
pub fn is_rtl(&self) -> bool
Returns true if the paragraph base direction is RTL (odd base level).
Sourcepub fn levels(&self) -> &[Level]
pub fn levels(&self) -> &[Level]
Returns the per-byte UAX #9 embedding levels for the source text.
The returned slice is indexed by UTF-8 byte offset. Multi-byte characters
have their level repeated for each byte. Use the cluster byte offset from
a oxitext_core::ShapedGlyph to look up the level for that glyph.
Auto Trait Implementations§
impl Freeze for BidiParagraph
impl RefUnwindSafe for BidiParagraph
impl Send for BidiParagraph
impl Sync for BidiParagraph
impl Unpin for BidiParagraph
impl UnsafeUnpin for BidiParagraph
impl UnwindSafe for BidiParagraph
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> 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 more