Enum zng::layout::TextSegmentKind
source · pub enum TextSegmentKind {
}
Expand description
The type of an inline/text segment.
Variants§
LeftToRight
Any strong left-to-right character.
RightToLeft
Any strong right-to-left (non-Arabic-type) character.
ArabicLetter
Any strong right-to-left (Arabic-type) character.
EuropeanNumber
Any ASCII digit or Eastern Arabic-Indic digit.
EuropeanSeparator
Plus and minus signs.
EuropeanTerminator
A terminator in a numeric format context, includes currency signs.
ArabicNumber
Any Arabic-Indic digit.
CommonSeparator
Commas, colons, and slashes.
NonSpacingMark
Any non-spacing mark.
BoundaryNeutral
Most format characters, control codes, or non-characters.
Emoji
Emoji chars, components and zero-width-joiner between emoji.
LineBreak
Various newline characters.
Tab
A sequence of '\t', '\v'
or '\u{1F}'
.
Space
Spaces.
OtherNeutral
Most other symbols and punctuation marks.
Bracket(char)
Open or close bidi bracket.
Can be any chars in https://unicode.org/Public/UNIDATA/BidiBrackets.txt.
BidiCtrl(char)
Bidi control character.
Chars can be:
-
\u{202A}
: The LR embedding control. -
\u{202D}
: The LR override control. -
\u{202B}
: The RL embedding control. -
\u{202E}
: The RL override control. -
\u{202C}
: Terminates an embedding or override control. -
\u{2066}
: The LR isolate control. -
\u{2067}
: The RL isolate control. -
\u{2068}
: The first strong isolate control. -
\u{2069}
: Terminates an isolate control.
Implementations§
source§impl TextSegmentKind
impl TextSegmentKind
sourcepub fn is_word(self) -> bool
pub fn is_word(self) -> bool
Returns true
if the segment can be considered part of a word for the purpose of inserting letter spacing.
sourcepub fn is_space(self) -> bool
pub fn is_space(self) -> bool
Returns true
if the segment can be considered part of space between words for the purpose of inserting word spacing.
sourcepub fn is_line_break(self) -> bool
pub fn is_line_break(self) -> bool
Returns true
if the segment terminates the current line.
Line break segments are the last segment of their line and explicitly start a new line.
sourcepub fn can_merge(self) -> bool
pub fn can_merge(self) -> bool
If multiple segments of this same kind can be represented by a single segment in the Unicode bidi algorithm.
sourcepub fn bracket_info(self) -> Option<BidiMatchedOpeningBracket>
pub fn bracket_info(self) -> Option<BidiMatchedOpeningBracket>
Get more info about the bracket char if self
is Bracket(_)
with a valid char.
sourcepub fn strong_direction(self) -> Option<LayoutDirection>
pub fn strong_direction(self) -> Option<LayoutDirection>
Gets the layout direction this segment will always be in, independent of the base direction.
Returns None
if the segment direction depends on the line context.
Trait Implementations§
source§impl Clone for TextSegmentKind
impl Clone for TextSegmentKind
source§fn clone(&self) -> TextSegmentKind
fn clone(&self) -> TextSegmentKind
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TextSegmentKind
impl Debug for TextSegmentKind
source§impl<'de> Deserialize<'de> for TextSegmentKind
impl<'de> Deserialize<'de> for TextSegmentKind
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TextSegmentKind, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TextSegmentKind, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl From<BidiClass> for TextSegmentKind
impl From<BidiClass> for TextSegmentKind
source§fn from(value: BidiClass) -> TextSegmentKind
fn from(value: BidiClass) -> TextSegmentKind
source§impl From<char> for TextSegmentKind
impl From<char> for TextSegmentKind
source§fn from(c: char) -> TextSegmentKind
fn from(c: char) -> TextSegmentKind
source§impl Hash for TextSegmentKind
impl Hash for TextSegmentKind
source§impl PartialEq for TextSegmentKind
impl PartialEq for TextSegmentKind
source§impl Serialize for TextSegmentKind
impl Serialize for TextSegmentKind
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for TextSegmentKind
impl Eq for TextSegmentKind
impl StructuralPartialEq for TextSegmentKind
Auto Trait Implementations§
impl Freeze for TextSegmentKind
impl RefUnwindSafe for TextSegmentKind
impl Send for TextSegmentKind
impl Sync for TextSegmentKind
impl Unpin for TextSegmentKind
impl UnwindSafe for TextSegmentKind
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
source§impl<T> AnyVarValue for Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self
equals other
.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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> FsChangeNote for T
impl<T> FsChangeNote for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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