Skip to content

Commit

Permalink
fix for AttributeError exception raised when xHeight and CapHeight va…
Browse files Browse the repository at this point in the history
…lues are missing from OS/2 table in some fonts (#14) cc:@gingerbeardman
  • Loading branch information
chrissimpkins committed Nov 25, 2017
1 parent 3087bf9 commit 123fbb7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/fontline/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ def get_font_report(fontpath):
os2_win_ascent = tt['OS/2'].usWinAscent
os2_win_descent = tt['OS/2'].usWinDescent
os2_typo_linegap = tt['OS/2'].sTypoLineGap
os2_x_height = tt['OS/2'].sxHeight
os2_cap_height = tt['OS/2'].sCapHeight
try:
os2_x_height = tt['OS/2'].sxHeight
except AttributeError as e:
os2_x_height = "---- (OS/2 table does not contain sxHeight record)"
try:
os2_cap_height = tt['OS/2'].sCapHeight
except AttributeError as e:
os2_cap_height = "---- (OS/2 table does not contain sCapHeight record)"
hhea_ascent = tt['hhea'].ascent
hhea_descent = tt['hhea'].descent
hhea_linegap = tt['hhea'].lineGap
Expand Down

0 comments on commit 123fbb7

Please sign in to comment.