diff --git a/shaperglot-lib/src/checks/codepoint_coverage.rs b/shaperglot-lib/src/checks/codepoint_coverage.rs index 8f0f733..28739eb 100644 --- a/shaperglot-lib/src/checks/codepoint_coverage.rs +++ b/shaperglot-lib/src/checks/codepoint_coverage.rs @@ -16,6 +16,8 @@ pub struct CodepointCoverage { strings: HashSet, /// The unique code to return on failure (e.g. "marks-missing") code: String, + /// Whether to mark the problem as terminal if no codepoints are found + terminal_if_empty: bool, } fn can_shape(text: &str, face: &Face) -> bool { @@ -53,7 +55,7 @@ impl CheckImplementation for CodepointCoverage { missing_things.join(", ") ), ); - if missing_things.len() == self.strings.len() { + if missing_things.len() == self.strings.len() && self.terminal_if_empty { fail.terminal = true; } fail.context = json!({"glyphs": missing_things}); @@ -76,10 +78,11 @@ impl CheckImplementation for CodepointCoverage { impl CodepointCoverage { /// Create a new `CodepointCoverage` check implementation - pub fn new(test_strings: Vec, code: String) -> Self { + pub fn new(test_strings: Vec, code: String, terminal_if_empty: bool) -> Self { Self { strings: test_strings.into_iter().collect(), code, + terminal_if_empty, } } } diff --git a/shaperglot-lib/src/providers/orthographies.rs b/shaperglot-lib/src/providers/orthographies.rs index 0f4b8b0..0a362c5 100644 --- a/shaperglot-lib/src/providers/orthographies.rs +++ b/shaperglot-lib/src/providers/orthographies.rs @@ -59,6 +59,7 @@ fn mandatory_orthography(language: &Language) -> Check { implementations: vec![CheckType::CodepointCoverage(CodepointCoverage::new( language.bases.clone(), "base".to_string(), + true, ))], }; let marks: Vec = language.marks.iter().map(|s| s.replace("◌", "")).collect(); @@ -68,6 +69,7 @@ fn mandatory_orthography(language: &Language) -> Check { .push(CheckType::CodepointCoverage(CodepointCoverage::new( marks, "mark".to_string(), + false, ))); } let complex_bases: Vec = language @@ -128,6 +130,7 @@ fn auxiliaries_check(language: &Language) -> Option { .push(CheckType::CodepointCoverage(CodepointCoverage::new( vec![codepoint.clone()], "auxiliary".to_string(), + false, ))); } // If auxiliary exemplars contain marks, they SHOULD NOT be orphaned.