Crates.io | runestr-pancjkv |
lib.rs | runestr-pancjkv |
version | 0.1.1 |
source | src |
created_at | 2021-08-07 04:50:19.058483 |
updated_at | 2021-08-07 05:11:15.584645 |
description | `rune`-based Pan-CJKV support |
homepage | |
repository | |
max_upload_size | |
id | 432690 |
size | 15,858 |
rune
-based PanCJKV IVD Collection supportPanCJKV IVD Collection is an unregistered IVD collection, that makes use of Unicode Variation Selectors to distinguish CJK ideograph glyphs on a per-region basis.
This crate add support for PanCJKV IVD Collection support to rune
-based iterators, by allowing unannotated CJK ideograph abstract characters be transformed into annotated form explicitly.
use runestr::{rune, RuneString};
use runestr_pancjkv::{PanCJKVAnnotate, PanCJKVRegion}
fn main() {
let test = RuneString::from_str_lossy("\u{6211}\u{030C}\u{4EEC}\u{E01EE}\u{0301}");
assert_eq!(2, test.runes().count());
let result = test
.runes()
.annotate_with_pan_cjkv_region(PanCJKVRegion::XK) // annotate with a presedo region called KangXi
.collect::<RuneString>();
assert_eq!(
&result.chars().collect::<Vec<_>>()[..],
&[
'\u{6211}',
'\u{E01EF}', // this variation selector is inserted
'\u{030C}',
'\u{4EEC}',
'\u{E01EE}', // this is untouched
'\u{0301}'
]
);
assert_eq!(2, result.runes().count()); // rune count does not change
}