We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0b209f9 + 6a3e7bf commit 4039615Copy full SHA for 4039615
adafruit_display_text/__init__.py
100644
100755
@@ -56,7 +56,12 @@ def measure(text):
56
font.load_glyphs(string)
57
58
def measure(text):
59
- return sum(font.get_glyph(ord(c)).shift_x for c in text)
+ total_len = 0
60
+ for char in text:
61
+ this_glyph = font.get_glyph(ord(char))
62
+ if this_glyph:
63
+ total_len += this_glyph.shift_x
64
+ return total_len
65
66
lines = []
67
partial = [indent0]
0 commit comments