- changed some variable names

- added -b command line argument: sets recalcBBoxes to false


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@13 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
Just 1999-12-18 18:12:15 +00:00
parent a7b9f2919e
commit ac7c6fa894
2 changed files with 30 additions and 24 deletions

View File

@ -1,38 +1,41 @@
#! /usr/bin/env python #! /usr/bin/env python
"""\ """\
usage: %s [-h] [-v] [-i TrueType-input-file] XML-file [TrueType-file] usage: %s [-h] [-v] [-i TrueType-input-file] XML-file [TrueType-output-file]
-i TrueType-input-file: specify a TT file to be merged with the XML file -i TrueType-input-file: specify a TT file to be merged with the XML file
-v verbose: messages will be written to stdout about what is being done -v verbose: messages will be written to stdout about what is being done
-b Don't recalc glyph boundig boxes: use the values in the XML file as-is.
-h help: print this message -h help: print this message
""" """
import sys, os, getopt import sys, os, getopt
from fontTools import ttLib from fontTools import ttLib
options, args = getopt.getopt(sys.argv[1:], "hvi:") options, args = getopt.getopt(sys.argv[1:], "hvi:b")
verbose = 0 verbose = 0
tt_infile = None ttInFile = None
recalcBBoxes = 1
for option, value in options: for option, value in options:
if option == "-i": if option == "-i":
tt_infile = value ttInFile = value
elif option == "-v": elif option == "-v":
verbose = 1 verbose = 1
elif option == "-h": elif option == "-h":
print __doc__ % sys.argv[0] print __doc__ % sys.argv[0]
sys.exit(0) sys.exit(0)
elif option == "-b":
recalcBBoxes = 0
if len(args) == 1: if len(args) == 1:
xmlpath = args[0] xmlPath = args[0]
name, ext = os.path.splitext(xmlpath) name, ext = os.path.splitext(xmlPath)
ttpath = name + '.ttf' ttPath = name + '.ttf'
elif len(args) == 2: elif len(args) == 2:
xmlpath, ttpath = args xmlPath, ttPath = args
else: else:
print __doc__ % sys.argv[0] print __doc__ % sys.argv[0]
sys.exit(2) sys.exit(2)
tt = ttLib.TTFont(tt_infile, verbose=verbose) tt = ttLib.TTFont(ttInFile, verbose=verbose)
tt.importXML(xmlpath) tt.importXML(xmlPath)
tt.save(ttpath) tt.save(ttPath, recalcBBoxes=recalcBBoxes)

View File

@ -1,38 +1,41 @@
#! /usr/bin/env python #! /usr/bin/env python
"""\ """\
usage: %s [-h] [-v] [-i TrueType-input-file] XML-file [TrueType-file] usage: %s [-h] [-v] [-i TrueType-input-file] XML-file [TrueType-output-file]
-i TrueType-input-file: specify a TT file to be merged with the XML file -i TrueType-input-file: specify a TT file to be merged with the XML file
-v verbose: messages will be written to stdout about what is being done -v verbose: messages will be written to stdout about what is being done
-b Don't recalc glyph boundig boxes: use the values in the XML file as-is.
-h help: print this message -h help: print this message
""" """
import sys, os, getopt import sys, os, getopt
from fontTools import ttLib from fontTools import ttLib
options, args = getopt.getopt(sys.argv[1:], "hvi:") options, args = getopt.getopt(sys.argv[1:], "hvi:b")
verbose = 0 verbose = 0
tt_infile = None ttInFile = None
recalcBBoxes = 1
for option, value in options: for option, value in options:
if option == "-i": if option == "-i":
tt_infile = value ttInFile = value
elif option == "-v": elif option == "-v":
verbose = 1 verbose = 1
elif option == "-h": elif option == "-h":
print __doc__ % sys.argv[0] print __doc__ % sys.argv[0]
sys.exit(0) sys.exit(0)
elif option == "-b":
recalcBBoxes = 0
if len(args) == 1: if len(args) == 1:
xmlpath = args[0] xmlPath = args[0]
name, ext = os.path.splitext(xmlpath) name, ext = os.path.splitext(xmlPath)
ttpath = name + '.ttf' ttPath = name + '.ttf'
elif len(args) == 2: elif len(args) == 2:
xmlpath, ttpath = args xmlPath, ttPath = args
else: else:
print __doc__ % sys.argv[0] print __doc__ % sys.argv[0]
sys.exit(2) sys.exit(2)
tt = ttLib.TTFont(tt_infile, verbose=verbose) tt = ttLib.TTFont(ttInFile, verbose=verbose)
tt.importXML(xmlpath) tt.importXML(xmlPath)
tt.save(ttpath) tt.save(ttPath, recalcBBoxes=recalcBBoxes)