File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change 20
20
# TODO: support integer addition and subtraction to the linegap value through new sub-commands
21
21
# TODO: support .woff and .woff2 file types?
22
22
# TODO: JSON formatted metrics output
23
+ # TODO: autocorrect command?
23
24
24
25
25
26
def main ():
@@ -81,7 +82,7 @@ def main():
81
82
if modify_linegap_percent (fontpath , percent ) is True :
82
83
outpath = get_linegap_percent_filepath (fontpath , percent )
83
84
stdout ("[font-line] '" + fontpath + "' successfully modified to '" + outpath + "'." )
84
- else :
85
+ else : # pragma: no cover
85
86
stderr ("[font-line] ERROR: Unsuccessful modification of '" + fontpath + "'." )
86
87
else :
87
88
stderr ("[font-line] ERROR: '" + fontpath + "' does not appear to be a supported font file type." )
Original file line number Diff line number Diff line change @@ -78,12 +78,8 @@ def modify_linegap_percent(fontpath, percent):
78
78
79
79
factor = 1.0 * int (percent ) / 100
80
80
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
87
83
88
84
hhea_ascent = int (os2_typo_ascender + 0.5 * os2_typo_linegap )
89
85
hhea_descent = - (total_height - hhea_ascent )
@@ -101,7 +97,7 @@ def modify_linegap_percent(fontpath, percent):
101
97
102
98
tt .save (get_linegap_percent_filepath (fontpath , percent ))
103
99
return True
104
- except Exception as e :
100
+ except Exception as e : # pragma: no cover
105
101
stderr ("[font-line] ERROR: Unable to modify the line spacing in the font file '" + fontpath + "'. " + str (e ))
106
102
sys .exit (1 )
107
103
You can’t perform that action at this time.
0 commit comments