Skip to content

Commit

Permalink
Merge pull request #752 from ryanoasis/bugfix/try-to-save-ttc [skip ci]
Browse files Browse the repository at this point in the history
Handle TTCs gracefully
  • Loading branch information
ryanoasis authored Jan 9, 2022
2 parents d2cd41e + 702e4be commit 877887c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class font_patcher:
sys.exit("{}: Font file does not exist: {}".format(projectName, self.args.font))
if not os.access(self.args.font, os.R_OK):
sys.exit("{}: Can not open font file for reading: {}".format(projectName, self.args.font))
if len(fontforge.fontsInFile(self.args.font)) > 1:
sys.exit("{}: Font file contains {} fonts, can only handle single font files".format(projectName,
len(fontforge.fontsInFile(self.args.font))))
try:
self.sourceFont = fontforge.open(self.args.font, 1) # 1 = ("fstypepermitted",))
except Exception:
Expand All @@ -72,6 +75,8 @@ class font_patcher:
self.extension = os.path.splitext(self.args.font)[1]
else:
self.extension = '.' + self.args.extension
if re.match("\.ttc$", self.extension, re.IGNORECASE):
sys.exit(projectName + ": Can not create True Type Collections")


def patch(self):
Expand Down

0 comments on commit 877887c

Please sign in to comment.