Skip to content

Commit 1dcecb9

Browse files
authored
Merge pull request #56 from FoamyGuy/fix_max_glyphs
fix max_glyphs count when text wasn't passed in constructor
2 parents f5288fc + 5fe2117 commit 1dcecb9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

adafruit_display_text/label.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ def __init__(
8282
if not max_glyphs and not text:
8383
raise RuntimeError("Please provide a max size, or initial text")
8484
if not max_glyphs:
85-
max_glyphs = len(text) + 1 # add one for the background bitmap tileGrid
86-
super().__init__(max_size=max_glyphs, **kwargs)
85+
max_glyphs = len(text)
86+
# add one to max_size for the background bitmap tileGrid
87+
super().__init__(max_size=max_glyphs + 1, **kwargs)
8788

8889
self.width = max_glyphs
8990
self._font = font

0 commit comments

Comments
 (0)