Skip to content

Commit

Permalink
[makeotf] Ignore trailing slashes in input font path
Browse files Browse the repository at this point in the history
Fixes #280
  • Loading branch information
miguelsousa committed Jun 19, 2018
1 parent 0b05933 commit ddaa448
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Tests/makeotf_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import platform
import pytest
from shutil import copytree
import subprocess32 as subprocess
import tempfile

Expand Down Expand Up @@ -85,3 +86,14 @@ def test_input_formats(arg, input_filename, otf_filename):
' <checkSumAdjustment value=' + SPLIT_MARKER +
' <created value=' + SPLIT_MARKER +
' <modified value='])


def test_ufo_with_trailing_slash_bug280():
# makeotf will now save the OTF alongside the UFO instead of inside of it
ufo_path = _get_input_path(UFO2_NAME)
temp_dir = tempfile.mkdtemp()
tmp_ufo_path = os.path.join(temp_dir, UFO2_NAME)
copytree(ufo_path, tmp_ufo_path)
runner(CMD + ['-n', '-a', '-o', 'f', '_{}{}'.format(tmp_ufo_path, os.sep)])
expected_path = os.path.join(temp_dir, 'SourceSansPro-Regular.otf')
assert os.path.isfile(expected_path)
2 changes: 1 addition & 1 deletion afdko/Tools/SharedData/FDKScripts/MakeOTF.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ def getOptions(makeOTFParams):
elif arg == kMOTFOptions[kInputFont][1]:
kMOTFOptions[kInputFont][0] = i + optionIndex
try:
file_path = args[i]
file_path = os.path.abspath(os.path.realpath(args[i]))
exec("makeOTFParams.%s%s = file_path" % (kFileOptPrefix,
kInputFont))
except IndexError:
Expand Down

0 comments on commit ddaa448

Please sign in to comment.