adafruit / Adafruit_CircuitPython_Display_Text

Library to display text using displayio
MIT License
57 stars 38 forks source link

Exception with multiple consecutive newlines in bitmap label #183

Closed jepler closed 1 year ago

jepler commented 1 year ago
>>> l = adafruit_display_text.bitmap_label.Label(terminalio.FONT)
>>> l.text = '1\n\n\n\n\n\n\n\n\n\n1'
Warning: Glyph clipped, exceeds descent property: "1"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_display_text/__init__.py", line 416, in text
  File "adafruit_display_text/bitmap_label.py", line 539, in _set_text
  File "adafruit_display_text/bitmap_label.py", line 206, in _reset_text
  File "adafruit_display_text/bitmap_label.py", line 443, in _place_text
  File "adafruit_display_text/bitmap_label.py", line 469, in _blit
ValueError: out of range of target

This may be because _text_bounding_box does not correctly account for multiple consecutive newlines.