Created
July 12, 2022 01:20
-
-
Save simonsj/75975d9838b6ce76fbaa115f62f27db0 to your computer and use it in GitHub Desktop.
extract-ttf-from-ttc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# extract-ttf-from-ttc.py <input.ttc> | |
# | |
# Extract individual .ttf files from a .ttc. | |
# | |
from fontTools.ttLib import TTCollection | |
import sys | |
file = sys.argv[1] | |
collection = TTCollection(file) | |
for i, font in enumerate(collection.fonts): | |
print(f"collection.fonts[{i}]: {font}") | |
print(f"font[\"name\"]: {font['name']}") | |
font.save(f"./{i}.ttf") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment