1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2024-12-13 17:18:37 +02:00
nerd-fonts/bin/scripts/name_parser/query_version
Fini Jastrow 6d86114a38 Draft: Introduce a file name parser
DO NOT MERGE

[why]
A lot of the fonts have incorrect naming after patching. A completely
different approach can help to come up with a consistent naming scheme.

[how]
See bin/scripts/name-parser/README.md

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-22 10:53:05 +02:00

27 lines
686 B
Python

#!/usr/bin/env python
# coding=utf8
import fontforge
import sys
def get_sfnt_dict(font):
"""Extract SFNT table as nice dict"""
return { k: v for l, k, v in font.sfnt_names }
if len(sys.argv) != 2:
print("Usage: {} font_name\n".format(sys.argv[0]))
sys.exit(1)
font = fontforge.open(sys.argv[1])
sfnt = get_sfnt_dict(font)
print("Version is '{}'".format(font.version));
print("CID Version is '{}'".format(font.cidversion));
print("SFNT Revision is '{}'".format(font.sfntRevision));
if "Version" in sfnt:
print("SFNT ['Version'] is '{}'".format(sfnt["Version"]));
else:
print("SFNT ['Version'] is not set".format(sys.argv[1]));
font.close()