Skip to content

Commit

Permalink
Minor refactoring of EastAsianSpacingTester
Browse files Browse the repository at this point in the history
  • Loading branch information
kojiishi committed Jan 4, 2022
1 parent 5bce949 commit 02678a8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions east_asian_spacing/tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ def should_apply(self, glyph_id_sets: Optional[Tuple[Set[int]]], em=None):
if self.off_glyphs[self.index].advance != em:
return False
if glyph_id_sets:
if self.off_glyphs[0].glyph_id not in glyph_id_sets[0]:
return False
if self.off_glyphs[1].glyph_id not in glyph_id_sets[1]:
return False
for i, glyph_id_set in enumerate(glyph_id_sets):
if self.off_glyphs[i].glyph_id not in glyph_id_set:
return False
return True

@property
Expand All @@ -82,7 +81,7 @@ def fail(self, reason):
def __str__(self):
text = ' '.join(f'U+{ch:04X}' for ch in self.input)
if len(self.fail_reasons) == 0:
return f' {text}: PASSS'
return f' {text}: PASS'
if self.glyphs == self.off_glyphs:
glyphs_str = str(self.glyphs)
else:
Expand Down

0 comments on commit 02678a8

Please sign in to comment.