IsNormalized,
};
pub use crate::recompose::Recompositions;
+pub use crate::replace::Replacements;
pub use crate::stream_safe::StreamSafe;
pub use crate::tables::UNICODE_VERSION;
use core::str::Chars;
mod perfect_hash;
mod quick_check;
mod recompose;
+mod replace;
mod stream_safe;
#[rustfmt::skip]
/// Methods for composing and decomposing characters.
pub mod char {
- pub use crate::normalize::{compose, decompose_canonical, decompose_compatible};
+ pub use crate::normalize::{
+ compose, decompose_canonical, decompose_cjk_compat_variants, decompose_compatible,
+ };
pub use crate::lookups::{canonical_combining_class, is_combining_mark};
}
/// (compatibility decomposition followed by canonical composition).
fn nfkc(self) -> Recompositions<I>;
+ /// A transformation which replaces CJK Compatibility Ideograph codepoints
+ /// with normal forms using Standardized Variation Sequences. This is not
+ /// part of the canonical or compatibility decomposition algorithms, but
+ /// performing it before those algorithms produces normalized output which
+ /// better preserves the intent of the original text.
+ ///
+ /// Note that many systems today ignore variation selectors, so these
+ /// may not immediately help text display as intended, but they at
+ /// least preserve the information in a standardized form, giving
+ /// implementations the option to recognize them.
+ fn cjk_compat_variants(self) -> Replacements<I>;
+
/// An Iterator over the string with Conjoining Grapheme Joiner characters
/// inserted according to the Stream-Safe Text Process (UAX15-D4)
fn stream_safe(self) -> StreamSafe<I>;
recompose::new_compatible(self.chars())
}
+ #[inline]
+ fn cjk_compat_variants(self) -> Replacements<Chars<'a>> {
+ replace::new_cjk_compat_variants(self.chars())
+ }
+
#[inline]
fn stream_safe(self) -> StreamSafe<Chars<'a>> {
StreamSafe::new(self.chars())
recompose::new_compatible(self)
}
+ #[inline]
+ fn cjk_compat_variants(self) -> Replacements<I> {
+ replace::new_cjk_compat_variants(self)
+ }
+
#[inline]
fn stream_safe(self) -> StreamSafe<I> {
StreamSafe::new(self)