Skip to content

Commit 7439eb8

Browse files
committed
removed test for typo_descender value, should never be defined in way that was tested
1 parent 574d349 commit 7439eb8

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

lib/fontline/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# TODO: support integer addition and subtraction to the linegap value through new sub-commands
2121
# TODO: support .woff and .woff2 file types?
2222
# TODO: JSON formatted metrics output
23+
# TODO: autocorrect command?
2324

2425

2526
def main():
@@ -81,7 +82,7 @@ def main():
8182
if modify_linegap_percent(fontpath, percent) is True:
8283
outpath = get_linegap_percent_filepath(fontpath, percent)
8384
stdout("[font-line] '" + fontpath + "' successfully modified to '" + outpath + "'.")
84-
else:
85+
else: # pragma: no cover
8586
stderr("[font-line] ERROR: Unsuccessful modification of '" + fontpath + "'.")
8687
else:
8788
stderr("[font-line] ERROR: '" + fontpath + "' does not appear to be a supported font file type.")

lib/fontline/commands.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,8 @@ def modify_linegap_percent(fontpath, percent):
7878

7979
factor = 1.0 * int(percent) / 100
8080

81-
if os2_typo_descender < 0:
82-
os2_typo_linegap = int(factor * (os2_typo_ascender + -(os2_typo_descender)))
83-
total_height = os2_typo_ascender + -(os2_typo_descender) + os2_typo_linegap
84-
else:
85-
os2_typo_linegap = int(factor * (os2_typo_ascender + os2_typo_descender))
86-
total_height = os2_typo_ascender + os2_typo_descender + os2_typo_linegap
81+
os2_typo_linegap = int(factor * (os2_typo_ascender + -(os2_typo_descender)))
82+
total_height = os2_typo_ascender + -(os2_typo_descender) + os2_typo_linegap
8783

8884
hhea_ascent = int(os2_typo_ascender + 0.5 * os2_typo_linegap)
8985
hhea_descent = -(total_height - hhea_ascent)
@@ -101,7 +97,7 @@ def modify_linegap_percent(fontpath, percent):
10197

10298
tt.save(get_linegap_percent_filepath(fontpath, percent))
10399
return True
104-
except Exception as e:
100+
except Exception as e: # pragma: no cover
105101
stderr("[font-line] ERROR: Unable to modify the line spacing in the font file '" + fontpath + "'. " + str(e))
106102
sys.exit(1)
107103

0 commit comments

Comments
 (0)