Skip to content

Commit 633ee3e

Browse files
committed
Handle All correctly
1 parent d162865 commit 633ee3e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/mixed_script.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ impl From<ScriptExtension> for AugmentedScriptSet {
2222
let mut jpan = false;
2323
let mut kore = false;
2424

25-
if ext.contains_script(Script::Han) {
25+
if ext == ScriptExtension::Single(Script::Common) ||
26+
ext == ScriptExtension::Single(Script::Inherited) ||
27+
ext.contains_script(Script::Han) {
2628
hanb = true;
2729
jpan = true;
2830
kore = true;
@@ -84,6 +86,12 @@ impl AugmentedScriptSet {
8486
self.base.is_empty() && ! self.hanb && !self.jpan && !self.kore
8587
}
8688

89+
/// Check if the set is "All" (Common or Inherited)
90+
pub fn is_all(&self) -> bool {
91+
self.base == ScriptExtension::Single(Script::Common) ||
92+
self.base == ScriptExtension::Single(Script::Inherited)
93+
}
94+
8795
/// Construct an AugmentedScriptSet for a given character
8896
pub fn for_char(c: char) -> Self {
8997
ScriptExtension::from(c).into()

0 commit comments

Comments
 (0)