Skip to content

How to split ttc to ttf #2647

Answered by anthrotype
gachiemchiep asked this question in Q&A
Discussion options

You must be logged in to vote

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 the ttx tool to recompile the .ttx files to individual binary font files.
Or you could use a script like this one:

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.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yozhic
Comment options

Answer selected by khaledhosny
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2646 on June 10, 2022 11:11.