usecrate::{props::EnumeratedProperty, provider::PropertyEnumBidiMirroringGlyphV1}; use icu_collections::codepointtrie::TrieValue; use zerovec::ule::{AsULE, RawBytesULE};
/// This is a bitpacked combination of the `Bidi_Mirroring_Glyph`, /// `Bidi_Mirrored`, and `Bidi_Paired_Bracket_Type` properties. #[derive(Debug, Eq, PartialEq, Clone, Copy, Default)] #[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))] #[cfg_attr(feature = "datagen", databake(path = icu_properties::props))] #[cfg_attr(feature = "serde", derive(serde::Deserialize))] #[allow(clippy::exhaustive_structs)] // needed for baked construction pubstruct BidiMirroringGlyph { /// The mirroring glyph pub mirroring_glyph: Option<char>, /// Whether the glyph is mirrored pub mirrored: bool, /// The paired bracket type pub paired_bracket_type: BidiPairedBracketType,
}
/// The enum represents `Bidi_Paired_Bracket_Type`. /// /// It does not implement [`EnumeratedProperty`], instead it can be obtained /// through the bitpacked [`BidiMirroringGlyph`] property. /// /// If you have a use case this property without also needing the [`BidiMirroringGlyph`] /// property, and need to optimize data size, please file an issue. #[derive(Debug, Eq, PartialEq, Copy, Clone, Default)] #[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))] #[cfg_attr(feature = "datagen", databake(path = icu_properties::props))] #[cfg_attr(feature = "serde", derive(serde::Deserialize))] #[non_exhaustive] pubenum BidiPairedBracketType { /// Represents `Bidi_Paired_Bracket_Type=Open`.
Open, /// Represents `Bidi_Paired_Bracket_Type=Close`.
Close, /// Represents `Bidi_Paired_Bracket_Type=None`. #[default]
None,
}
/// ✨ *Enabled with the `unicode_bidi` Cargo feature.* /// /// # Examples /// ///``` /// use icu::properties::CodePointMapData; /// use icu::properties::props::BidiClass; /// use unicode_bidi::BidiInfo; /// /// // This example text is defined using `concat!` because some browsers /// // and text editors have trouble displaying bidi strings. /// let text = concat!["א", // RTL#1 /// "ב", // RTL#2 /// "ג", // RTL#3 /// "a", // LTR#1 /// "b", // LTR#2 /// "c", // LTR#3 /// ]; // /// /// /// let bidi_map = CodePointMapData::<BidiClass>::new(); /// /// // Resolve embedding levels within the text. Pass `None` to detect the /// // paragraph level automatically. /// let bidi_info = BidiInfo::new_with_data_source(&bidi_map, text, None); /// /// // This paragraph has embedding level 1 because its first strong character is RTL. /// assert_eq!(bidi_info.paragraphs.len(), 1); /// let para = &bidi_info.paragraphs[0]; /// assert_eq!(para.level.number(), 1); /// assert!(para.level.is_rtl()); /// /// // Re-ordering is done after wrapping each paragraph into a sequence of /// // lines. For this example, I'll just use a single line that spans the /// // entire paragraph. /// let line = para.range.clone(); /// /// let display = bidi_info.reorder_line(para, line); /// assert_eq!(display, concat!["a", // LTR#1 /// "b", // LTR#2 /// "c", // LTR#3 /// "ג", // RTL#3 /// "ב", // RTL#2 /// "א", // RTL#1 /// ]); /// ``` #[cfg(feature = "unicode_bidi")] impl unicode_bidi::data_source::BidiDataSource forcrate::CodePointMapDataBorrowed<'_, BidiClass> { fn bidi_class(&self, c: char) -> unicode_bidi::BidiClass { self.get(c).into()
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.