Skip to content

Commit 62dd78a

Browse files
committed
Handle missing glyphs
1 parent 7320e8f commit 62dd78a

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
__pycache__
2+

adafruit_bitmap_font/bdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def load_glyphs(self, code_points):
8585
code_point = int(code_point)
8686
if code_point == code_points or code_point in code_points:
8787
total_remaining -= 1
88-
if code_point not in self._glyphs:
88+
if code_point not in self._glyphs or not self._glyphs[code_point]:
8989
desired_character = True
9090
current_info = {"bitmap": None, "bounds": None, "shift": None}
9191
elif line.startswith(b"DWIDTH"):

adafruit_bitmap_font/glyph_cache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def get_glyph(self, code_point):
1010

1111
s = set()
1212
s.add(code_point)
13+
self._glyphs[code_point] = None
1314
self.load_glyphs(s)
1415
gc.collect()
1516
return self._glyphs[code_point]

0 commit comments

Comments
 (0)