Merge pull request #2414 from jepler/speedup-gen-display-resources

gen_display_resources: speed it up
This commit is contained in:
Scott Shawcroft 2019-12-19 15:48:22 -08:00 committed by GitHub
commit 773e1316d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -48,18 +48,19 @@ for c in sample_characters:
all_characters += c
if args.extra_characters:
all_characters.extend(args.extra_characters)
all_characters = "".join(sorted(set(all_characters)))
filtered_characters = all_characters
# Try to pre-load all of the glyphs. Misses will still be slow later.
f.load_glyphs(set(all_characters))
f.load_glyphs(set(ord(c) for c in all_characters))
# Get each glyph.
for c in all_characters:
g = f.get_glyph(ord(c))
if not g:
for c in set(all_characters):
if ord(c) not in f._glyphs:
print("Font missing character:", c, ord(c))
filtered_characters = filtered_characters.replace(c, "")
continue
g = f.get_glyph(ord(c))
if g["shift"][1] != 0:
raise RuntimeError("y shift")