Skip to content

Instantly share code, notes, and snippets.

@tai271828
Forked from yrcjaya/split_ttc_font_to_ttf.py
Created August 4, 2018 08:06
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tai271828/6f08b24d813355585f613c0c80bd774a to your computer and use it in GitHub Desktop.
Save tai271828/6f08b24d813355585f613c0c80bd774a to your computer and use it in GitHub Desktop.
Convert font TTC to TTF
"""Convert TTC font to TTF using fontforge with python extension.
**Warning** The scripts saves splitted fonts in the current working directory.
Usage:
split_ttc_font_to_ttf.py Droid.ttc
Preinstallation: apt-get install python-fontforge
"""
import sys
import fontforge
fonts = fontforge.fontsInFile(sys.argv[1])
for fontName in fonts:
font = fontforge.open('%s(%s)'%(sys.argv[1], fontName))
font.generate('%s.ttf'%fontName)
font.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment