Skip to content

Commit

Permalink
check-googlefonts: Updated Warn message for com_google_fonts_test_075
Browse files Browse the repository at this point in the history
The previous implementation would produced incredibly long messages for
handwitten or display fonts. It would unnecessarily repeat the lengthy
description of why this error happens for each glyph. This information
is only needed at the end of the test.
  • Loading branch information
m4rc1e committed Oct 19, 2017
1 parent acce457 commit 6de3a1b
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Lib/fontbakery/specifications/googlefonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2765,6 +2765,7 @@ def com_google_fonts_test_074(ttFont):
def com_google_fonts_test_075(ttFont):
"""Check for points out of bounds."""
failed = False
out_of_bounds = []
for glyphName in ttFont['glyf'].keys():
glyph = ttFont['glyf'][glyphName]
coords = glyph.getCoordinates(ttFont['glyf'])[0]
Expand All @@ -2773,17 +2774,19 @@ def com_google_fonts_test_075(ttFont):
y < glyph.yMin or y > glyph.yMax or \
abs(x) > 32766 or abs(y) > 32766:
failed = True
yield WARN, ("Glyph '{}' coordinates ({},{})"
" out of bounds."
" This happens a lot when points are not extremes,"
" which is usually bad. However, fixing this alert"
" by adding points on extremes may do more harm"
" than good, especially with italics,"
" calligraphic-script, handwriting, rounded and"
" other fonts. So it is common to"
" ignore this message.").format(glyphName, x, y)
if not failed:
yield PASS, "All glyph paths have coordinates within bounds!"
out_of_bounds.append((glyphName, x, y))

if failed:
yield WARN, ("The following glyphs have coordinates which are"
" out of bounds:\n{}\nThis happens a lot when points"
" are not extremes, which is usually bad. However,"
" fixing this alert by adding points on extremes may"
" do more harm than good, especially with italics,"
" calligraphic-script, handwriting, rounded and"
" other fonts. So it is common to"
" ignore this message".format(out_of_bounds))
else:
yield PASS, "All glyph paths have coordinates within bounds!"


@register_test
Expand Down

0 comments on commit 6de3a1b

Please sign in to comment.