Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions lib/fontcustom/scripts/generate.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fontforge
import os
import shutil
import subprocess
import tempfile
import json
Expand Down Expand Up @@ -126,16 +127,12 @@ def createGlyph( name, source, code ):
manifest['fonts'].append(fontfile + '.woff')

# Convert EOT for IE7
subprocess.call('python ' + scriptPath + '/eotlitetool.py ' + fontfile + '.ttf -o ' + fontfile + '.eot', shell=True)
# check if windows
if os.name == 'nt':
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

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

manifest['fonts'].append(fontfile + '.eot')

# 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

manifest['fonts'].append(fontfile + '.woff2')

finally:
Expand Down