rm-hull / luma.examples

Companion repo for running examples against the luma.oled, luma.lcd, luma.led_matrix and luma.emulator display drivers.
MIT License
380 stars 147 forks source link

font_awesome example throws error with luma.led_matrix #106

Open thijstriemstra opened 5 years ago

thijstriemstra commented 5 years ago
$ python examples/font_awesome.py --config max7219.conf
Version: luma.led_matrix 1.4.0 (luma.core 1.12.0)
Display: max7219
Interface: spi
Dimensions: 8 x 8
------------------------------------------------------------
Traceback (most recent call last):
  File "examples/font_awesome.py", line 161, in <module>
    main()
  File "examples/font_awesome.py", line 153, in main
    w, h = draw.textsize(text=code, font=font)
  File "/home/pi/.virtualenvs/foo/lib/python3.5/site-packages/PIL/ImageDraw.py", line 339, in textsize
    return font.getsize(text, direction, features, language)
  File "/home/pi/.virtualenvs/foo/lib/python3.5/site-packages/PIL/ImageFont.py", line 223, in getsize
    size, offset = self.font.getsize(text, direction, features, language)
OSError: raster overflow

it uses the default max7219.conf.

--display=max7219
--interface=spi
--width=8
--height=8

@rm-hull any idea how to render the icons using a max7219 device?

rm-hull commented 4 years ago

i think it would be a stretch to scale the TTF icons into 8x8 pixels .. sounds like it is emanating from FreeType2 (see https://www.freetype.org/freetype2/docs/reference/ft2-error_code_values.html)

Might be worth trying again with the latest Pillow 8 patch - I think the headline change was around font rendering (see https://pillow.readthedocs.io/en/stable/releasenotes/8.0.1.html#security)