diff options
author | Rasmus Andersson <rasmus@notion.se> | 2018-09-03 22:55:49 +0300 |
---|---|---|
committer | Rasmus Andersson <rasmus@notion.se> | 2018-09-03 22:55:49 +0300 |
commit | c833e252c925e8dd68108660710ca835d95daa6f (patch) | |
tree | 6b2e28264ed45efd7f054e453b622098d0d875b8 /misc/tools/glyphcheck.py | |
parent | 8c1a4c181ef12000179dfec541f1af87e9b03122 (diff) | |
download | inter-c833e252c925e8dd68108660710ca835d95daa6f.tar.xz |
Major overhaul, moving from UFO2 to Glyphs and UFO3, plus a brand new and much simpler fontbuild
Diffstat (limited to 'misc/tools/glyphcheck.py')
-rwxr-xr-x | misc/tools/glyphcheck.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/misc/tools/glyphcheck.py b/misc/tools/glyphcheck.py new file mode 100755 index 000000000..755de686f --- /dev/null +++ b/misc/tools/glyphcheck.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# encoding: utf8 +import sys, argparse +from fontTools import ttLib + + +def main(): + argparser = argparse.ArgumentParser(description='Check glyph names') + + argparser.add_argument('fontfiles', metavar='<path>', type=str, nargs='+', + help='TrueType or OpenType font files') + + args = argparser.parse_args() + + nmissing = 0 + + matchnames = set() + for line in sys.stdin: + line = line.strip() + if len(line) > 0 and line[0] != '#': + for line2 in line.split(): + line2 = line2.strip() + if len(line2) > 0: + matchnames.add(line2) + + for fontfile in args.fontfiles: + font = ttLib.TTFont(fontfile) + glyphnames = set(font.getGlyphOrder()) + + # for name in glyphnames: + # if not name in matchnames: + # print('%s missing in input' % name) + + for name in matchnames: + if not name in glyphnames: + print('%s missing in font' % name) + nmissing = nmissing + 1 + + + if nmissing == 0: + print('all glyphs found') + + +if __name__ == '__main__': + main() |