Skip to content

Commit

Permalink
Change skip reasons to warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kojiishi committed Jul 31, 2021
1 parent e88120a commit 9a6037a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
11 changes: 7 additions & 4 deletions east_asian_spacing/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ async def _config_for_font(self, font: Font) -> Optional[Config]:
logger.info('Skipped because monospace: "%s"', font)
return None
if font.is_aat_morx:
logger.info('Skipped because AAT morx is not supported: "%s"',
font)
logger.warning('Skipped because AAT morx is not supported: "%s"',
font)
return None
if EastAsianSpacing.font_has_feature(font):
logger.info('Skipped because the features exist: "%s"', font)
logger.warning('Skipped because the features exist: "%s"', font)
return None
return config

Expand Down Expand Up @@ -272,7 +272,10 @@ async def main():
builder = Builder(font, config)
await builder.build()
if not builder.has_spacings:
logger.warning('Skipped saving due to no changes: "%s"', input)
if builder.config.for_font(builder.font) is None:
logger.info('Skipped by config: "%s"', input)
else:
logger.warning('Skipped due to no changes: "%s"', input)
continue
builder.save(args.output,
stem_suffix=args.suffix,
Expand Down
12 changes: 8 additions & 4 deletions east_asian_spacing/spacing.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def __init__(self, left=None, right=None, middle=None, space=None):
self.right = right if right is not None else set()
self.middle = middle if middle is not None else set()
self.space = space if space is not None else set()

self._add_glyphs_count = 0
# For checking purposes. Because this class keeps glyph IDs, using the
# same instance for different fonts may lead to unexpected behaviors,
# except they share the same glyph set.
Expand Down Expand Up @@ -117,13 +119,13 @@ def add_by_ink_part(self, glyphs, font):

async def add_glyphs(self, font, config):
self.assert_font(font)
if not await Shaper.ensure_fullwidth_advance(font):
logger.info('Skipped because proportional CJK: "%s"', font)
return
config = config.for_font(font)
if not config:
logger.info('Skipped by config: "%s"', font)
return
if not await Shaper.ensure_fullwidth_advance(font):
logger.warning('Skipped because proportional CJK: "%s"', font)
return
results = await asyncio.gather(self.get_opening_closing(font, config),
self.get_period_comma(font, config),
self.get_colon_semicolon(font, config),
Expand All @@ -132,6 +134,7 @@ async def add_glyphs(self, font, config):
self.unite(result)
self.add_to_cache(font)
self.assert_glyphs_are_disjoint()
self._add_glyphs_count += 1

async def _shape(self, font, unicodes, language=None, temporary=False):
text = ''.join(chr(c) for c in unicodes)
Expand Down Expand Up @@ -384,7 +387,8 @@ def add_to_font(self, font: Font) -> bool:
self.assert_font(font)
self.assert_glyphs_are_disjoint()
if not self._can_add_to_table:
logger.info('Skipped because no pairs: "%s"', font)
if self._add_glyphs_count:
logger.warning('Skipped because no pairs: "%s"', font)
return False

table = font.gpos_ottable(create=True)
Expand Down

0 comments on commit 9a6037a

Please sign in to comment.