Skip to content

Commit cb5e370

Browse files
authored
Merge pull request adafruit#51 from caternuson/iss50
Add NoneType check for glyph height
2 parents 1f2bf53 + d9f759e commit cb5e370

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

adafruit_display_text/label.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,9 @@ def _create_background_box(self, lines, y_offset):
141141
ascender_max = descender_max = 0
142142
for char in glyphs:
143143
this_glyph = self._font.get_glyph(ord(char))
144-
ascender_max = max(ascender_max, this_glyph.height + this_glyph.dy)
145-
descender_max = max(descender_max, -this_glyph.dy)
144+
if this_glyph:
145+
ascender_max = max(ascender_max, this_glyph.height + this_glyph.dy)
146+
descender_max = max(descender_max, -this_glyph.dy)
146147

147148
box_width = self._boundingbox[2] + self._padding_left + self._padding_right
148149
x_box_offset = -self._padding_left

0 commit comments

Comments
 (0)