Merge pull request #3300 from jepler/count-missing-chars
gen_display_resources: report missing character count, if any
This commit is contained in:
commit
837abd6da0
@ -58,15 +58,20 @@ filtered_characters = all_characters
|
|||||||
# Try to pre-load all of the glyphs. Misses will still be slow later.
|
# Try to pre-load all of the glyphs. Misses will still be slow later.
|
||||||
f.load_glyphs(set(ord(c) for c in all_characters))
|
f.load_glyphs(set(ord(c) for c in all_characters))
|
||||||
|
|
||||||
|
missing = 0
|
||||||
# Get each glyph.
|
# Get each glyph.
|
||||||
for c in set(all_characters):
|
for c in set(all_characters):
|
||||||
if ord(c) not in f._glyphs:
|
if ord(c) not in f._glyphs:
|
||||||
|
missing += 1
|
||||||
filtered_characters = filtered_characters.replace(c, "")
|
filtered_characters = filtered_characters.replace(c, "")
|
||||||
continue
|
continue
|
||||||
g = f.get_glyph(ord(c))
|
g = f.get_glyph(ord(c))
|
||||||
if g["shift"][1] != 0:
|
if g["shift"][1] != 0:
|
||||||
raise RuntimeError("y shift")
|
raise RuntimeError("y shift")
|
||||||
|
|
||||||
|
if missing > 0:
|
||||||
|
print("Font missing", missing, "characters", file=sys.stderr)
|
||||||
|
|
||||||
x, y, dx, dy = f.get_bounding_box()
|
x, y, dx, dy = f.get_bounding_box()
|
||||||
tile_x, tile_y = x - dx, y - dy
|
tile_x, tile_y = x - dx, y - dy
|
||||||
total_bits = tile_x * len(all_characters)
|
total_bits = tile_x * len(all_characters)
|
||||||
|
Loading…
Reference in New Issue
Block a user