luisgabrielroldan

luisgabrielroldan

Chisel - a library to render text on pixel based devices

Hi community!

This is my first post in the forum! (Hope I’m doing it well :sweat_smile:)
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 :tada:, 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:

  1. Load the font…
{:ok, font} = Chisel.Font.load("you/font/file.bdf")
  1. … 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!

Most Liked

lawik

lawik

Nerves Core Team

I love that you made this thing. Absolutely wildly useful for small display projects. As you know there is plenty more I want us to try based off of this :slight_smile:

AstonJ

AstonJ

This is so cool! I love the display showing the emojis :003:

Is this the module you are using?

LukeWood

LukeWood

Super awesome love it!

luisgabrielroldan

luisgabrielroldan

Yes! That one works with the OLED library.

jaimeiniesta

jaimeiniesta

Hey @luisgabrielroldan that’s cool!

Do you think that would work with a Zio Qwiic OLED Display which is based on an SSD1327 chip?

I’m looking to attach an OLED to my Raspberry Pi Zero and it needs to be a Qwiic device because I’m using the Qwiic pHat connector already.

Where Next?

Popular in Libraries Top

scohen
Lexical Lexical is a next-generation language server for the Elixir programming language. Features Context aware code completion As-you...
New
josevalim
Hi everyone, We would like to announce that Plataformatec is working on a new MySQL driver called MyXQL. Our goal is to eventually integ...
New
Qqwy
TypeCheck: Fast and flexible runtime type-checking for your Elixir projects. Core ideas Type- and function specifications are const...
336 13801 100
New
tmbb
I’ve been working on two packages (not on hex.pm yet) to build admin interfaces for phoenix apps: bureaucrat - which contains a bunch ...
New
Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
zoltanszogyenyi
Hey everyone :wave: Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-source U...
New
tompave
Hello there, I would like to share a feature toggles library (AKA feature flags) I’ve been working on. The main package is FunWithFlags...
New
Qqwy
Solution is a library to help you with working with ok/error-tuples in case and with-expressions by exposing special matching macros, as ...
New
Antrater
Hi everyone! I’m thrilled to announce a huge thing. We have been developing Elixir Moon Design System for quite a while. We are finally ...
New
bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
381 12391 119
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

Sub Categories:

We're in Beta

About us Mission Statement