pub struct TaggedString {
pub styled_text: (U16String, Vec<u8>),
pub sections: Vec<SectionOptions>,
pub supports_vertical_writing_mode: Option<bool>,
pub image_section_id: u16,
}Expand description
A TaggedString is the shaping-code counterpart of the Formatted type Whereas Formatted matches the logical structure of a ‘format’ expression, a TaggedString represents the same data at a per-character level so that character-rearranging operations (e.g. BiDi) preserve formatting. Text is represented as:
- A string of characters
- A matching array of indices, pointing to:
- An array of SectionsOptions, representing the evaluated formatting options of the original sections.
Once the guts of a TaggedString have been re-arranged by BiDi, you can iterate over the contents in order, using getCharCodeAt and getSection to get the formatting options for each character in turn. maplibre/maplibre-native#4add9ea original name: TaggedString
Fields§
§styled_text: (U16String, Vec<u8>)§sections: Vec<SectionOptions>§supports_vertical_writing_mode: Option<bool>§image_section_id: u16Implementations§
Source§impl TaggedString
impl TaggedString
const WHITESPACE_CHARS: &'static [u16]
Sourcepub fn new_from_raw(text_: U16String, options: SectionOptions) -> Self
pub fn new_from_raw(text_: U16String, options: SectionOptions) -> Self
maplibre/maplibre-native#4add9ea original name: new_from_raw
Sourcepub fn new(
styled_text: (U16String, Vec<u8>),
sections_: Vec<SectionOptions>,
) -> Self
pub fn new( styled_text: (U16String, Vec<u8>), sections_: Vec<SectionOptions>, ) -> Self
maplibre/maplibre-native#4add9ea original name: new
Sourcepub fn section_count(&self) -> usize
pub fn section_count(&self) -> usize
maplibre/maplibre-native#4add9ea original name: sectionCount
Sourcepub fn get_section(&self, index: usize) -> &SectionOptions
pub fn get_section(&self, index: usize) -> &SectionOptions
maplibre/maplibre-native#4add9ea original name: getSection
Sourcepub fn get_char_code_at(&self, index: usize) -> u16
pub fn get_char_code_at(&self, index: usize) -> u16
maplibre/maplibre-native#4add9ea original name: getCharCodeAt
Sourcepub fn get_styled_text(&self) -> &(U16String, Vec<u8>)
pub fn get_styled_text(&self) -> &(U16String, Vec<u8>)
maplibre/maplibre-native#4add9ea original name: getStyledText
Sourcepub fn add_text_section(
&mut self,
section_text: &U16String,
scale: f64,
font_stack: Vec<String>,
text_color: Option<Color>,
)
pub fn add_text_section( &mut self, section_text: &U16String, scale: f64, font_stack: Vec<String>, text_color: Option<Color>, )
maplibre/maplibre-native#4add9ea original name: addTextSection
Sourcepub fn add_image_section(&mut self, image_id: String)
pub fn add_image_section(&mut self, image_id: String)
maplibre/maplibre-native#4add9ea original name: addImageSection
Sourcepub fn section_at(&self, index: usize) -> &SectionOptions
pub fn section_at(&self, index: usize) -> &SectionOptions
maplibre/maplibre-native#4add9ea original name: sectionAt
Sourcepub fn get_sections(&self) -> &Vec<SectionOptions>
pub fn get_sections(&self) -> &Vec<SectionOptions>
maplibre/maplibre-native#4add9ea original name: getSections
Sourcepub fn get_section_index(&self, character_index: usize) -> u8
pub fn get_section_index(&self, character_index: usize) -> u8
maplibre/maplibre-native#4add9ea original name: getSectionIndex
Sourcepub fn get_max_scale(&self) -> f64
pub fn get_max_scale(&self) -> f64
maplibre/maplibre-native#4add9ea original name: getMaxScale
Sourcepub fn verticalize_punctuation(&mut self)
pub fn verticalize_punctuation(&mut self)
maplibre/maplibre-native#4add9ea original name: verticalizePunctuation
Sourcepub fn allows_vertical_writing_mode(&mut self) -> bool
pub fn allows_vertical_writing_mode(&mut self) -> bool
maplibre/maplibre-native#4add9ea original name: allowsVerticalWritingMode
Source§impl TaggedString
impl TaggedString
Sourcefn get_next_image_section_char_code(&mut self) -> Option<u16>
fn get_next_image_section_char_code(&mut self) -> Option<u16>
maplibre/maplibre-native#4add9ea original name: getNextImageSectionCharCode
Trait Implementations§
Source§impl Clone for TaggedString
impl Clone for TaggedString
Source§fn clone(&self) -> TaggedString
fn clone(&self) -> TaggedString
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for TaggedString
impl RefUnwindSafe for TaggedString
impl Send for TaggedString
impl Sync for TaggedString
impl Unpin for TaggedString
impl UnwindSafe for TaggedString
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> 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<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> 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