[ttLib/__main__] Add --flavor
This commit is contained in:
parent
f651809ac5
commit
0715940830
@ -85,11 +85,18 @@ def main(args=None):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--no-lazy", dest="lazy", action="store_false", help="Load fonts immediately."
|
"--no-lazy", dest="lazy", action="store_false", help="Load fonts immediately."
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--flavor",
|
||||||
|
dest="flavor",
|
||||||
|
default=None,
|
||||||
|
help="Flavor of output font. 'woff' or 'woff2'.",
|
||||||
|
)
|
||||||
options = parser.parse_args(args)
|
options = parser.parse_args(args)
|
||||||
|
|
||||||
fontNumber = int(options.y) if options.y is not None else None
|
fontNumber = int(options.y) if options.y is not None else None
|
||||||
outFile = options.output
|
outFile = options.output
|
||||||
lazy = options.lazy
|
lazy = options.lazy
|
||||||
|
flavor = options.flavor
|
||||||
|
|
||||||
fonts = []
|
fonts = []
|
||||||
for f in options.font:
|
for f in options.font:
|
||||||
@ -102,8 +109,11 @@ def main(args=None):
|
|||||||
|
|
||||||
if outFile is not None:
|
if outFile is not None:
|
||||||
if len(fonts) == 1:
|
if len(fonts) == 1:
|
||||||
|
fonts[0].flavor = flavor
|
||||||
fonts[0].save(outFile)
|
fonts[0].save(outFile)
|
||||||
else:
|
else:
|
||||||
|
if flavor is not None:
|
||||||
|
raise TTLibError("Cannot set flavor for collections.")
|
||||||
collection = TTCollection()
|
collection = TTCollection()
|
||||||
collection.fonts = fonts
|
collection.fonts = fonts
|
||||||
collection.save(outFile)
|
collection.save(outFile)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user