Skip to content

Commit b40a386

Browse files
committed
fix for font path bug reported by @Phantom-code in IR #3
1 parent 9487538 commit b40a386

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/fontline/app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from fontline.commands import get_font_report, modify_linegap_percent, get_linegap_percent_filepath
1818
from fontline.utilities import file_exists, is_supported_filetype
1919

20-
# TODO: support integer addition and subtraction to the linegap value through new sub-commands
20+
# TODO: support integer addition and subtraction to the metrics values through new sub-commands
2121
# TODO: support .woff and .woff2 file types?
2222
# TODO: JSON formatted metrics output
2323
# TODO: autocorrect command?

lib/fontline/commands.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
import sys
5+
import os.path
56

67
from fontTools import ttLib
78
from fontline.utilities import get_sha1
@@ -111,5 +112,8 @@ def modify_linegap_percent(fontpath, percent):
111112

112113

113114
def get_linegap_percent_filepath(fontpath, percent):
114-
path_list = fontpath.split(".")
115-
return path_list[0] + "-linegap" + percent + "." + path_list[1]
115+
font_basename = os.path.basename(fontpath)
116+
font_dirname = os.path.dirname(fontpath)
117+
basepath_list = font_basename.split(".")
118+
outfile_basename = basepath_list[0] + "-linegap" + percent + "." + basepath_list[1]
119+
return os.path.join(font_dirname, outfile_basename)

0 commit comments

Comments
 (0)