Added support to merge multiple XML files into one font (the opposite of tt2xml.py's -s option). Improved doc string.

git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@38 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
Just 1999-12-27 19:52:01 +00:00
parent 08ff1b43f0
commit 94940dabb6
2 changed files with 30 additions and 4 deletions

View File

@ -2,7 +2,13 @@
"""\ """\
usage: %s [-h] [-v] [-i TrueType-input-file] XML-file [TrueType-output-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 Translate an XML file (as output by tt2xml.py) to a TrueType font file.
If the XML-file argument is a directory instead of a file, all files
ending in '.xml' will be merged into one TrueType file. This is mostly
useful in conjunction with the -s option of tt2xml.py.
Options:
-i TrueType-input-file: specify a TT file to be merged with the XML file(s)
-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. -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
@ -37,7 +43,14 @@ else:
sys.exit(2) sys.exit(2)
tt = ttLib.TTFont(ttInFile, recalcBBoxes=recalcBBoxes, verbose=verbose) tt = ttLib.TTFont(ttInFile, recalcBBoxes=recalcBBoxes, verbose=verbose)
tt.importXML(xmlPath)
if os.path.isdir(xmlPath):
import glob
os.chdir(xmlPath)
for xmlFile in glob.glob("*.xml"):
tt.importXML(xmlFile)
else:
tt.importXML(xmlPath)
tt.save(ttPath) tt.save(ttPath)
del tt del tt
if verbose: if verbose:

View File

@ -2,7 +2,13 @@
"""\ """\
usage: %s [-h] [-v] [-i TrueType-input-file] XML-file [TrueType-output-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 Translate an XML file (as output by tt2xml.py) to a TrueType font file.
If the XML-file argument is a directory instead of a file, all files
ending in '.xml' will be merged into one TrueType file. This is mostly
useful in conjunction with the -s option of tt2xml.py.
Options:
-i TrueType-input-file: specify a TT file to be merged with the XML file(s)
-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. -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
@ -37,7 +43,14 @@ else:
sys.exit(2) sys.exit(2)
tt = ttLib.TTFont(ttInFile, recalcBBoxes=recalcBBoxes, verbose=verbose) tt = ttLib.TTFont(ttInFile, recalcBBoxes=recalcBBoxes, verbose=verbose)
tt.importXML(xmlPath)
if os.path.isdir(xmlPath):
import glob
os.chdir(xmlPath)
for xmlFile in glob.glob("*.xml"):
tt.importXML(xmlFile)
else:
tt.importXML(xmlPath)
tt.save(ttPath) tt.save(ttPath)
del tt del tt
if verbose: if verbose: