Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
rsheeter committed Aug 15, 2023
1 parent 1e7f01d commit 9026914
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions glyphs2fontir/src/glyphdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use std::collections::HashSet;

// Do a quick (relative to large match on str) check to see if this might be a mark
#[inline(always)]
pub(crate) fn might_be_a_nonspacing_mark_name(name: &str) -> bool {
// shove the first 4 chars into a u32 and see if they could possibly be a nonspacing mark
Expand Down Expand Up @@ -698,6 +699,7 @@ pub(crate) fn is_nonspacing_mark_name(name: &str) -> bool {
if name.len() > 35 || matches!(name.len(), 1 | 2) {
return false;
}
// fast exit: this can't possibly be a nonspacing mark
if !might_be_a_nonspacing_mark_name(name) {
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions resources/scripts/non_spacing_marks.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def main(_):
print(len(unique_prefix4s), "unique_prefix4s", sorted(unique_prefix4s))

f.write("\n")
f.write(" // Do a quick (relative to large match on str) check to see if this might be a mark\n")
f.write("#[inline(always)]\n")
f.write(
"pub(crate) fn might_be_a_nonspacing_mark_name(name: &str) -> bool {\n"
Expand Down Expand Up @@ -118,6 +119,7 @@ def main(_):
# f.write(" return false;\n")
# f.write(" };\n")

f.write(" // fast exit: this can't possibly be a nonspacing mark\n")
f.write(" if !might_be_a_nonspacing_mark_name(name) {\n")
f.write(" return false;\n")
f.write(" }\n")
Expand Down

0 comments on commit 9026914

Please sign in to comment.