Skip to content

Commit

Permalink
fix max_glyphs count when text wasn't passed in constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
FoamyGuy committed Jun 27, 2020
1 parent f5288fc commit 5fe2117
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions adafruit_display_text/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ def __init__(
if not max_glyphs and not text:
raise RuntimeError("Please provide a max size, or initial text")
if not max_glyphs:
max_glyphs = len(text) + 1 # add one for the background bitmap tileGrid
super().__init__(max_size=max_glyphs, **kwargs)
max_glyphs = len(text)
# add one to max_size for the background bitmap tileGrid
super().__init__(max_size=max_glyphs + 1, **kwargs)

self.width = max_glyphs
self._font = font
Expand Down

0 comments on commit 5fe2117

Please sign in to comment.