Skip to content

Instantly share code, notes, and snippets.

@prantlf
Forked from lilydjwg/ttc2ttf
Created July 19, 2018 04:35
Show Gist options
  • Save prantlf/71868ee7e1b2abd6f9153237d4e2b733 to your computer and use it in GitHub Desktop.
Save prantlf/71868ee7e1b2abd6f9153237d4e2b733 to your computer and use it in GitHub Desktop.
Convert .ttc to several .ttf files into the current directory
#!/usr/bin/env python2
import sys
import fontforge
def main(file):
for font in fontforge.fontsInFile(file):
f = fontforge.open(u'%s(%s)' % (file, font))
f.generate('%s.ttf' % font)
if __name__ == '__main__':
if len(sys.argv) != 2:
sys.exit('one ttc file one time.')
main(sys.argv[1])
@prantlf
Copy link
Author

prantlf commented Jul 19, 2018

Install fontforge with its python binding:

sudo apt-get install python2 fontforge python-fontforge 

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