From ff89b86078871c24b4c48a7420ed87580aae51df Mon Sep 17 00:00:00 2001 From: Justin Su <3387175+injust@users.noreply.github.com> Date: Wed, 3 Oct 2018 05:23:09 -0400 Subject: [PATCH] Generate font type corresponding to input font --- ligaturize.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ligaturize.py b/ligaturize.py index 6321ebd..1f7be17 100644 --- a/ligaturize.py +++ b/ligaturize.py @@ -282,8 +282,15 @@ def ligaturize_font(input_font_file, output_dir, ligature_font_file, # the underline width when you call generate(). font.upos += font.uwidth + # Generate font type (TTF or OTF) corresponding to input font extension + # (defaults to TTF) + if input_font_file[-4:].lower() == '.otf': + output_font_type = '.otf' + else: + output_font_type = '.ttf' + # Generate font & move to output directory - output_font_file = path.join(output_dir, font.fontname + '.ttf') + output_font_file = path.join(output_dir, font.fontname + output_font_type) print(" ...saving to '%s' (%s)" % (output_font_file, font.fullname)) font.generate(output_font_file)