Skip to content

Conversation

@TWiStErRob
Copy link

@TWiStErRob TWiStErRob commented Mar 17, 2019

Makes woff2 and paths containing spaces work on Windows.

Copy link
Author

@TWiStErRob TWiStErRob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See self-review for reasons.

subprocess.call('move ' + fontfile + '.eotlite ' + fontfile + '.eot', shell=True)
else:
subprocess.call('mv ' + fontfile + '.eotlite ' + fontfile + '.eot', shell=True)
subprocess.call(['python', scriptPath + '/eotlitetool.py', fontfile + '.ttf', '-o', fontfile + '.eot'])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calling without shell makes spaces work in path


# Convert TTF to WOFF2
subprocess.call('woff2_compress \'' + fontfile + '.ttf\'', shell=True)
subprocess.call(['woff2_compress', fontfile + '.ttf'])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calling without shell and remove ' makes woff2 work on Windows. apostrophes are not supported by cmd.exe

else:
subprocess.call('mv ' + fontfile + '.eotlite ' + fontfile + '.eot', shell=True)
subprocess.call(['python', scriptPath + '/eotlitetool.py', fontfile + '.ttf', '-o', fontfile + '.eot'])
shutil.move(fontfile + '.eotlite', fontfile + '.eot')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using a Python builtin removes the need for platform dependent code, additionally supports spaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant