Skip to content

Commit

Permalink
Handle missing glyphs
Browse files Browse the repository at this point in the history
  • Loading branch information
tannewt committed Jan 26, 2019
1 parent 7320e8f commit 62dd78a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__

2 changes: 1 addition & 1 deletion adafruit_bitmap_font/bdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def load_glyphs(self, code_points):
code_point = int(code_point)
if code_point == code_points or code_point in code_points:
total_remaining -= 1
if code_point not in self._glyphs:
if code_point not in self._glyphs or not self._glyphs[code_point]:
desired_character = True
current_info = {"bitmap": None, "bounds": None, "shift": None}
elif line.startswith(b"DWIDTH"):
Expand Down
1 change: 1 addition & 0 deletions adafruit_bitmap_font/glyph_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def get_glyph(self, code_point):

s = set()
s.add(code_point)
self._glyphs[code_point] = None
self.load_glyphs(s)
gc.collect()
return self._glyphs[code_point]

0 comments on commit 62dd78a

Please sign in to comment.