Skip to content

Commit 95e1159

Browse files
qxliu76garretrieger
authored andcommitted
[glyph closure] move seen_sequence_indices out of loop
So we can reuse it
1 parent 1d3e931 commit 95e1159

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

read-fonts/src/tables/gsub/closure.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,7 @@ impl GlyphClosure for ContextFormat1<'_> {
750750
};
751751

752752
let lookups = lookup_list.lookups();
753+
let mut seen_sequence_indices = IntSet::new();
753754
for (gid, rule_set) in coverage
754755
.iter()
755756
.zip(self.rule_sets())
@@ -780,7 +781,7 @@ impl GlyphClosure for ContextFormat1<'_> {
780781
// we can no longer trivially determine the state of the context
781782
// at that point. In this case we give up, and assume that the
782783
// second lookup is reachable by all glyphs.
783-
let mut seen_sequence_indices = IntSet::new();
784+
seen_sequence_indices.clear();
784785

785786
for lookup_record in rule.lookup_records() {
786787
let lookup_index = lookup_record.lookup_list_index();
@@ -866,6 +867,7 @@ impl GlyphClosure for ContextFormat2<'_> {
866867
};
867868

868869
let lookups = lookup_list.lookups();
870+
let mut seen_sequence_indices = IntSet::new();
869871
for (i, rule_set) in self
870872
.rule_sets()
871873
.enumerate()
@@ -897,8 +899,7 @@ impl GlyphClosure for ContextFormat2<'_> {
897899
let input_seq = rule.input_sequence();
898900
let input_count = input_seq.len() + 1;
899901

900-
let mut seen_sequence_indices = IntSet::new();
901-
902+
seen_sequence_indices.clear();
902903
for lookup_record in rule.lookup_records() {
903904
let lookup_index = lookup_record.lookup_list_index();
904905
let lookup = match lookups.get(lookup_index as usize) {

0 commit comments

Comments
 (0)