{"id":21447384,"url":"https://github.com/luisgabrielroldan/chisel","last_synced_at":"2026-03-05T07:36:27.106Z","repository":{"id":51075983,"uuid":"224696698","full_name":"luisgabrielroldan/chisel","owner":"luisgabrielroldan","description":"A library to sculpt text on any device that you can handle pixels","archived":false,"fork":false,"pushed_at":"2024-06-12T00:32:52.000Z","size":1656,"stargazers_count":45,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-12-06T09:24:37.569Z","etag":null,"topics":["bitmap-font","lcd","renderer","text"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luisgabrielroldan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-28T16:58:15.000Z","updated_at":"2024-10-01T10:22:56.000Z","dependencies_parsed_at":"2022-09-21T10:52:41.700Z","dependency_job_id":null,"html_url":"https://github.com/luisgabrielroldan/chisel","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisgabrielroldan%2Fchisel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisgabrielroldan%2Fchisel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisgabrielroldan%2Fchisel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisgabrielroldan%2Fchisel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luisgabrielroldan","download_url":"https://codeload.github.com/luisgabrielroldan/chisel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229821820,"owners_count":18129428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitmap-font","lcd","renderer","text"],"created_at":"2024-11-23T03:09:52.855Z","updated_at":"2026-03-05T07:36:27.047Z","avatar_url":"https://github.com/luisgabrielroldan.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chisel\n![Actions Status](https://img.shields.io/github/actions/workflow/status/luisgabrielroldan/chisel/actions.yml?branch=master)\n[![github.com](https://img.shields.io/github/last-commit/luisgabrielroldan/chisel.svg)](https://github.com/luisgabrielroldan/chisel/commits/master)\n[![Hex version](https://img.shields.io/hexpm/v/chisel.svg \"Hex version\")](https://hex.pm/packages/chisel)\n[![Hex docs](http://img.shields.io/badge/hex.pm-docs-green.svg \"Hex docs\")](https://hexdocs.pm/chisel)\n\nChisel is a library that uses bitmap fonts to sculpt text on any device that can handle pixels.\n\n## Setup\n\nAdd Chisel to your mix.exs deps:\n\n```elixir\n{:chisel, \"~\u003e 0.2.0\"},\n```\n\nRun `mix deps.get` to download the new dependency.\n\n## Usage\n\n1. Take a function to draw pixels...\n\n```elixir\n  put_pixel = fn x, y -\u003e\n    YourDisplay.draw_pixel(x, y, ...)\n  end\n```\n\n2. Pick a BDF font (Look for one on the Internet or take one from the fixtures folder on this project)\n\n```elixir\n  {:ok, font} = Chisel.Font.load(\"foo/bar/font.bdf\")\n```\n\n3. Use Chisel to sculpt the text using the provided function and font\n\n```elixir\n  Chisel.Renderer.draw_text(\"Hello World!\", x, y, font, put_pixel)\n```\n\n4. Enjoy!\n\n![Demo](images/demo-inky.jpg)\n\n(Thanks to [lawik](https://github.com/lawik) for the picture)\n\n## General purpose\n\nChisel is a general purpose library that can be used to render text on any target based on pixels (LCD, Led matrixs, image files, ...).\n\n### Render on an image with `:egd`\n\n```elixir\n  img = :egd.create(200, 50)\n  color = :egd.color({0, 0, 0})\n\n  put_pixel = fn x, y -\u003e\n    :egd.line(img, {x, y}, {x, y}, color)\n  end\n\n  {:ok, font} = Chisel.Font.load(\"font.bdf\")\n\n  Chisel.Renderer.draw_text(\"Hello World!\", 0, 0, font, put_pixel)\n\n  :egd.save(:egd.render(img, :png), \"test.png\")\n```\n\n### Render ASCII art\n\n```elixir\n  put_pixel = fn x, y, pixels -\u003e\n    [{x, y} | pixels]\n  end\n\n  {:ok, font} = Chisel.Font.load(\"c64.bdf\")\n\n  {pixels, _, _} = Chisel.Renderer.reduce_draw_text(\"Hello World!\", 0, 0, font, [], put_pixel)\n\n  for y \u003c- 0..10 do\n    for x \u003c- 0..100 do\n      if Enum.member?(pixels, {x, y}) do\n        \"%\"\n      else\n        \" \"\n      end\n    end\n    |\u003e IO.puts()\n  end\n```\n\nResult:\n```\n                                                                                                     \n                                                                                                     \n %%  %%                                          %%   %%                                   %%        \n %%  %%           %%%     %%%                    %%   %%                  %%%        %%    %%        \n %%  %%   %%%%     %%      %%     %%%%           %%   %%  %%%%   %%%%%     %%        %%    %%        \n %%%%%%  %%  %%    %%      %%    %%  %%          %% % %% %%  %%  %%  %%    %%     %%%%%    %%        \n %%  %%  %%%%%%    %%      %%    %%  %%          %%%%%%% %%  %%  %%        %%    %%  %%              \n %%  %%  %%        %%      %%    %%  %%          %%% %%% %%  %%  %%        %%    %%  %%              \n %%  %%   %%%%    %%%%    %%%%    %%%%           %%   %%  %%%%   %%       %%%%    %%%%%    %%        \n                                                                                                     \n                                                                                                     \n```\n\n### Samples using [OLED](https://github.com/pappersverk/oled)\n\n![OLED Demo](images/demo-oled.jpg)\n\nUsing the right font it is even possible to render unicode strings.\n\nMany good BDF fonts are available [here](https://github.com/olikraus/u8g2/tree/master/tools/font/bdf) on the [U8g2](https://github.com/olikraus/u8g2) library repo.\n\nCheck fonts licenses [here](https://github.com/olikraus/u8g2/wiki/fntgrp).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluisgabrielroldan%2Fchisel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluisgabrielroldan%2Fchisel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluisgabrielroldan%2Fchisel/lists"}