Hi community!
This is my first post in the forum! (Hope I’m doing it well )
I want to share with you a project I’ve been working since a couple of weeks.
Some months ago I started to work on a driver for OLED displays based on SSD1306 (very popular and cheap!). It worked, had some primitives to draw points and lines… but that’s not quite useful.
On a second release I added a Scenic driver and the result is nice for graphics, but the text doesn’t looks well because of the antialiasing…
So this week I released the first version of Chisel , a library that can be used to write text on any device based on pixels (OLED, LCD, a LED Matrix).
Chisel is basically composed by two parts: a Font loader and a Renderer.
The only format supported for now is BDF which is a format for storing bitmap fonts (I want to add support for PCF in the future).
The use is pretty simple:
- Load the font…
{:ok, font} = Chisel.Font.load("you/font/file.bdf")
- … and write the text.
Chisel.Renderer.draw_text("Hello World!", x, y, font, put_pixel)
So… what is put_pixel
?
Is just a function that is called with the coordinates of the pixel to paint.
put_pixel = fn x, y ->
device.draw_pixel(x, y)
end
Here there are some examples using OLED and some fonts from U8glib:
And that’s all! What do you think? Did you have this text rendering requirements ever?
I would love to hear some feedback!
Thanks @lawik for testing the first prototype with [Inky] (https://github.com/pappersverk/inky)!
I hope you can found it useful and to see many people crafting things with tiny displays!
Thanks!