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:

Samples using OLED lib

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] (GitHub - pappersverk/inky: A library for managing Inky e-ink displays from Elixir. · GitHub)!

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?

https://www.amazon.co.uk/Hobby-Components-Ltd-SSD1306-Electronics/dp/B00KCM9JMG

LukeWood

LukeWood

Super awesome love it!

Where Next?

Popular in Announcing Top

mischov
import Meeseeks.CSS html = HTTPoison.get!("https://news.ycombinator.com/").body for story <- Meeseeks.all(html, css("tr.athing")) do...
New
deadtrickster
I’ve just released stable versions of my Prometheus Elixir libs: Elixir client [docs]; Ecto collector [docs]; Plugs instrumenter/Export...
New
devonestes
Introducing assertions, the library that helps you write really great test assertions! GitHub: GitHub - devonestes/assertions: Helpful a...
New
Qqwy
Today I realized that it would be possible to implement currying-capability in Elixir, using some clever anonymous function creation. (‘c...
New
woutdp
Hi! I wanted to introduce my latest project LiveSvelte. It allows you to render Svelte inside LiveView with end-to-end reactivity. It’s ...
New
kelvinst
Hey everyone! Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
michalmuskala
Another small library today. PersistentEts Hex: persistent_ets | Hex GitHub: GitHub - michalmuskala/persistent_ets · GitHub Ets table ...
New
michalmuskala
Hello everybody. I have just released Jason - a new JSON library. You might be wondering, why do we need a new library? The primary foc...
New
anshuman23
Hello all, I have been working on my proposed project called Tensorflex as part of Google Summer of Code 2018.. Tensorflex can be used f...
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
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
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 53690 245
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 47930 226
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement