adafruit/Adafruit_CircuitPython_Display_Text

builtin font does not have load_glyphs always

FoamyGuy opened this issue · 0 comments

in #85 we add a call to load_glyphs inside of _update_text and this made the label building / rendering work faster.

It looks like in some cases however this is resulting in an error when used with builtin font:

Traceback (most recent call last):
  File "code.py", line 15, in <module>
  File "adafruit_clue.py", line 913, in simple_text_display
  File "adafruit_clue.py", line 117, in __init__
  File "adafruit_clue.py", line 128, in add_text_line
  File "adafruit_display_text/label.py", line 125, in __init__
  File "adafruit_display_text/label.py", line 240, in _update_text
AttributeError: 'BuiltinFont' object has no attribute 'load_glyphs'

This was pointed out by a user in the #help-with-circuitpython channel on discord. They were working on the Clue Temperature and Humidity example project from here: https://learn.adafruit.com/adafruit-clue/clue-temperature-and-humidity-monitor I was able to recreate it with that project on a CLUE.

But I do suspect this issue might be more wide spread, perhaps any label that is using terminalio.FONT.

I think we could resolve this by putting the load_glyphs call inside of an if statement checking to make sure we aren't currently using terminalio.FONT