diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | scripts/setisFixedPitch-fonttools.py | 31 |
2 files changed, 16 insertions, 17 deletions
@@ -4,7 +4,7 @@ # 4web: dtto for TTF, WOFF, SVG, and EOT FONTFORGE = fontforge -PYTHON = python +PYTHON = python3 FONTLINT = fontlint # TTF->EOT converters in fallback order diff --git a/scripts/setisFixedPitch-fonttools.py b/scripts/setisFixedPitch-fonttools.py index 7f462af..d4e9adc 100644 --- a/scripts/setisFixedPitch-fonttools.py +++ b/scripts/setisFixedPitch-fonttools.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python3 # # setisFixedPitch-fonttools.py # @@ -24,28 +24,27 @@ # Usage: # # $ ./setisFixedPitch-fonttools.py FontIn.ttf -# "fontname"-fixed.ttf will be created with fixed isFixedPitch bit. +# input font will be overwriten and backup will be created for input font # Import our system library and fontTools ttLib -import os, sys +import sys from fontTools import ttLib -from fontTools.ttLib.tables import ttProgram for i in range(1, len(sys.argv)): # Open the font file supplied as the first argument on the command line - fontfile = sys.argv[i] - print fontfile - font = ttLib.TTFont(fontfile) + fontfile = sys.argv[i] + print(fontfile) + font = ttLib.TTFont(fontfile) # Print the Post table - if font.has_key('post'): - if font["post"].isFixedPitch == 0: - font["post"].isFixedPitch = 1 - print "isFixedPitch is now: ", font["post"].isFixedPitch - else: - print "Post table not found" + if 'post' in font: + if font["post"].isFixedPitch == 0: + font["post"].isFixedPitch = 1 + print("isFixedPitch is now: ", font["post"].isFixedPitch) + else: + print("Post table not found") # Save the new file with the name of the input file - newfont = fontfile[0:-4] + '-fixed' + fontfile[-4:] - font.save(newfont) - print newfont, "saved." + newfont = fontfile[0:-4] + '-fixed' + fontfile[-4:] + font.save(newfont) + print(newfont, "saved.") |