How to split ttc to ttf #2647
Answered
by
anthrotype
gachiemchiep
asked this question in
Q&A
-
Hello forks. |
Beta Was this translation helpful? Give feedback.
Answered by
anthrotype
Jun 10, 2022
Replies: 1 comment 1 reply
-
you can use from fontTools.ttLib.ttCollection import TTCollection
import os
import sys
filename = sys.argv[1]
ttc = TTCollection(filename)
basename = os.path.basename(filename)
for i, font in enumerate(ttc):
font.save(f"{basename}#{i}.ttf") next time please use https://github.com/fonttools/fonttools/discussions to ask questions instead of filing an issue. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
khaledhosny
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can use
ttx
command line tool with the-y
option for each sub-font in the ttc file to extract .ttx (XML) files for each of the sub-fonts, then again thettx
tool to recompile the .ttx files to individual binary font files.Or you could use a script like this one:
next time please use https://github.com/fonttools/fonttools/discussions to ask questions instead of filing an issue.