BlueAndi / Pixelix

Full RGB LED matrix, based on an ESP32 and WS2812B LEDs.
MIT License
300 stars 59 forks source link

8 pixel font? #86

Closed GRIETZEN closed 2 years ago

GRIETZEN commented 2 years ago

Would it be possible to replace the current (5-pixel height) font to an 8-pixel font to improve readability?

BlueAndi commented 2 years ago

In principle it is possible, but several plugins would need adaptions. E.g. the date/time can not show the day of the week below date/time info. IconTextLampPlugin won't work, the same for the VolumioPlugin. Which font do you have in mind?

GRIETZEN commented 2 years ago

I did a quick check on the source code of Pixelix but could no find any hint how and where the font is specified. Just to give you an idea, something like this:

https://github.com/TheRobotFactory/EightBit-Atari-Fonts

BlueAndi commented 2 years ago

Search for "font" and you should find all relevant places. In general the TextWidget is used by the plugins and it uses TomThumb font as default: https://github.com/BlueAndi/esp-rgb-led-matrix/blob/0eec32d71996096318bc8e529bda7f5f41612146/lib/YAWidgets/TextWidget.h#L91

https://github.com/BlueAndi/esp-rgb-led-matrix/blob/0eec32d71996096318bc8e529bda7f5f41612146/lib/YAWidgets/TextWidget.cpp#L65-L66

It provides a interface to change the font, which can be done by each plugin: https://github.com/BlueAndi/esp-rgb-led-matrix/blob/0eec32d71996096318bc8e529bda7f5f41612146/lib/YAWidgets/TextWidget.h#L239-L250

Find the TomThumb font here: https://github.com/BlueAndi/esp-rgb-led-matrix/blob/master/lib/YAWidgets/TomThumb.h

If you like to try it, you need to convert the font into the right format. Years ago I converted it from the original again and updated it in the Adafruit gfx lib too: https://github.com/adafruit/Adafruit-GFX-Library/pull/268

You will find there the script I was using.

GRIETZEN commented 2 years ago

Thanks, I will have a look into it....

BlueAndi commented 2 years ago

@GRIETZEN I added the possibility to choose the font type ("default", "normal" or "large") per plugin instance.

Example:

    {
      "name": "JustTextPlugin",
      "uid": 32690,
      "alias": "",
      "fontType": "large"
    }

Result: image

See ./lib/Fonts.cpp the font definitions itself. For the 8pt font I used https://github.com/muwerk/mufonts

You can test it in the "Development" branch.