Snippets/layout-features.py: allow to load from ttx file

This commit is contained in:
Cosimo Lupo 2018-05-23 11:50:40 +01:00
parent bbd1ba64b2
commit 299320d0b1
No known key found for this signature in database
GPG Key ID: 59D54DB0C9976482

View File

@ -10,7 +10,11 @@ if len(sys.argv) != 2:
print("usage: layout-features.py fontfile.ttf")
sys.exit(1)
fontfile = sys.argv[1]
font = TTFont(fontfile)
if fontfile.rsplit(".", 1)[-1] == "ttx":
font = TTFont()
font.importXML(fontfile)
else:
font = TTFont(fontfile)
for tag in ('GSUB', 'GPOS'):
if not tag in font: continue