[ttLib.main] Accept list of tables to decompile

Useful for performance measurement of load / save.
This commit is contained in:
Behdad Esfahbod 2023-10-13 12:13:21 -04:00
parent 98242634c4
commit 36eec087c4

View File

@ -50,6 +50,9 @@ def main(args=None):
""",
)
parser.add_argument("font", metavar="font", nargs="*", help="Font file.")
parser.add_argument(
"-t", "--table", metavar="table", nargs="*", help="Tables to decompile."
)
parser.add_argument(
"-o", "--output", metavar="FILE", default=None, help="Output file."
)
@ -74,6 +77,7 @@ def main(args=None):
outFile = options.output
lazy = options.lazy
flavor = options.flavor
tables = options.table if options.table is not None else []
fonts = []
for f in options.font:
@ -84,6 +88,10 @@ def main(args=None):
collection = TTCollection(f, lazy=lazy)
fonts.extend(collection.fonts)
for font in fonts:
for table in tables if "*" not in tables else font.keys():
font[table] # Decompiles
if outFile is not None:
if len(fonts) == 1:
fonts[0].flavor = flavor