diff --git a/tt2xml.py b/tt2xml.py
index eac82a483..7cebfb180 100644
--- a/tt2xml.py
+++ b/tt2xml.py
@@ -1,20 +1,31 @@
#! /usr/bin/env python
"""\
-usage: %s [-h] [-v] [-t
] TrueType-file [XML-output-file]
+usage: %s [-h] [-v] [-s] [-t ] TrueType-file [XML-output-file]
+ Dump a TrueType font as an XML file. If the XML-output-file argument
+ is omitted, the out put file name will be constructed from the input
+ file name, like so: *.ttf becomes *.xml. Either way, existing files
+ will be overwritten without warning!
+
+ Options:
-t specify a table to dump. Multiple -t options
are allowed. When no -t option is specified, all tables
will be dumped
- -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.
+ -s split tables: save the XML in a separate XML file per table.
+ The names of these files will be constructed from the
+ XML-output-file name as follows: *.xml becomes *..xml
-h help: print this message
"""
import sys, os, getopt
from fontTools import ttLib
-options, args = getopt.getopt(sys.argv[1:], "hvt:")
+options, args = getopt.getopt(sys.argv[1:], "shvt:")
verbose = 0
+splitTables = 0
tables = []
for option, value in options:
if option == "-t":
@@ -29,6 +40,8 @@ for option, value in options:
elif option == "-h":
print __doc__ % sys.argv[0]
sys.exit(0)
+ elif option == "-s":
+ splitTables = 1
if len(args) == 1:
@@ -42,4 +55,4 @@ else:
sys.exit(2)
tt = ttLib.TTFont(ttPath, verbose=verbose)
-tt.saveXML(xmlPath, tables=tables)
+tt.saveXML(xmlPath, tables=tables, splitTables=splitTables)
diff --git a/ttDump.py b/ttDump.py
index eac82a483..7cebfb180 100644
--- a/ttDump.py
+++ b/ttDump.py
@@ -1,20 +1,31 @@
#! /usr/bin/env python
"""\
-usage: %s [-h] [-v] [-t ] TrueType-file [XML-output-file]
+usage: %s [-h] [-v] [-s] [-t ] TrueType-file [XML-output-file]
+ Dump a TrueType font as an XML file. If the XML-output-file argument
+ is omitted, the out put file name will be constructed from the input
+ file name, like so: *.ttf becomes *.xml. Either way, existing files
+ will be overwritten without warning!
+
+ Options:
-t specify a table to dump. Multiple -t options
are allowed. When no -t option is specified, all tables
will be dumped
- -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.
+ -s split tables: save the XML in a separate XML file per table.
+ The names of these files will be constructed from the
+ XML-output-file name as follows: *.xml becomes *..xml
-h help: print this message
"""
import sys, os, getopt
from fontTools import ttLib
-options, args = getopt.getopt(sys.argv[1:], "hvt:")
+options, args = getopt.getopt(sys.argv[1:], "shvt:")
verbose = 0
+splitTables = 0
tables = []
for option, value in options:
if option == "-t":
@@ -29,6 +40,8 @@ for option, value in options:
elif option == "-h":
print __doc__ % sys.argv[0]
sys.exit(0)
+ elif option == "-s":
+ splitTables = 1
if len(args) == 1:
@@ -42,4 +55,4 @@ else:
sys.exit(2)
tt = ttLib.TTFont(ttPath, verbose=verbose)
-tt.saveXML(xmlPath, tables=tables)
+tt.saveXML(xmlPath, tables=tables, splitTables=splitTables)