Skip to content

Commit

Permalink
Merge pull request #1618 from googlefonts/coord-err-msg
Browse files Browse the repository at this point in the history
check-googlefonts: Updated Warn message for com_google_fonts_test_075
  • Loading branch information
felipesanches authored Oct 19, 2017
2 parents acce457 + 6de3a1b commit 757d0b9
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 757d0b9

Please sign in to comment.