Skip to content

Instantly share code, notes, and snippets.

@oesteban
Forked from lilydjwg/ttc2ttf
Created November 30, 2021 14:23
Show Gist options
  • Save oesteban/45ce58dae92154bf37a54cc683d139ab to your computer and use it in GitHub Desktop.
Save oesteban/45ce58dae92154bf37a54cc683d139ab to your computer and use it in GitHub Desktop.
Convert .ttc to several .ttf files into the current directory
#!/usr/bin/env python3
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])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment