All Projects → luisgabrielroldan → chisel

luisgabrielroldan / chisel

Licence: Apache-2.0 license
A library to sculpt text on any device that you can handle pixels

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to chisel

Render
Universal data-driven template for generating textual output, as a static binary and a library
Stars: ✭ 108 (+191.89%)
Mutual labels:  text, renderer
privacy-policy-template
Privacy Policy Template for website or app
Stars: ✭ 64 (+72.97%)
Mutual labels:  text
Cyotek.Drawing.BitmapFont
Component for parsing bitmap font files generated by AngelCode's BMFont utility
Stars: ✭ 35 (-5.41%)
Mutual labels:  bitmap-font
MD Menu
Menu system for displays with up to 2 lines
Stars: ✭ 49 (+32.43%)
Mutual labels:  lcd
instagram-text-editor
An Instagram like text editor Flutter widget that helps you to change your text style.
Stars: ✭ 66 (+78.38%)
Mutual labels:  text
5110LCD PCD8544.swift
A Swift library for the Nokia3310/5110 PCD8544 Monochrome LCD display
Stars: ✭ 28 (-24.32%)
Mutual labels:  lcd
link text
Easy to use text widget for Flutter apps, which converts inlined urls into working, clickable links
Stars: ✭ 20 (-45.95%)
Mutual labels:  text
pcd8544
Minimal footprint library for Philips PCD8544 LCDs on the Arduino.
Stars: ✭ 87 (+135.14%)
Mutual labels:  lcd
snowb-bmf
Bitmap Font Generator Online
Stars: ✭ 103 (+178.38%)
Mutual labels:  bitmap-font
Compressed2TXT
File(s)/Folder(s) "Send to" menu .bat ascii encoder with optional password and makecab lzx compression
Stars: ✭ 156 (+321.62%)
Mutual labels:  text
polyred
📺 3D Graphics in Go.
Stars: ✭ 31 (-16.22%)
Mutual labels:  renderer
text-classification-baseline
Pipeline for fast building text classification TF-IDF + LogReg baselines.
Stars: ✭ 55 (+48.65%)
Mutual labels:  text
text-sdk-php
PHP SDK to send messages with CM.com
Stars: ✭ 18 (-51.35%)
Mutual labels:  text
mg
OpenBSD Mg editor. Portable Public Domain Micro Emacs for *BSD, Cygwin, Linux, Mac OS X.
Stars: ✭ 99 (+167.57%)
Mutual labels:  text
edits.cr
Edit distance algorithms inc. Jaro, Damerau-Levenshtein, and Optimal Alignment
Stars: ✭ 16 (-56.76%)
Mutual labels:  text
AyaRay
A Modern C++ Windows-platform physically based renderer developing by Chang Yu.
Stars: ✭ 29 (-21.62%)
Mutual labels:  renderer
RubyTextMeshPro
Unity Text Mesh Proでルビ(フリガナ)のタグを追加しました.
Stars: ✭ 61 (+64.86%)
Mutual labels:  text
RAE
基于tensorflow搭建的神经网络recursive autuencode,用于实现句子聚类
Stars: ✭ 12 (-67.57%)
Mutual labels:  text
text-image
Convert text to image https://vincent7128.github.io/text-image/
Stars: ✭ 64 (+72.97%)
Mutual labels:  text
table
Produces a string that represents slice data in a text table, inspired by gajus/table.
Stars: ✭ 130 (+251.35%)
Mutual labels:  text

Chisel

GitHub Workflow Status github.com Hex version Hex docs

Chisel is a library that uses bitmap fonts to sculpt text on any device that can handle pixels.

Setup

Add Chisel to your mix.exs deps:

{:chisel, "~> 0.2.0"},

Run mix deps.get to download the new dependency.

Usage

  1. Take a function to draw pixels...
  put_pixel = fn x, y ->
    YourDisplay.draw_pixel(x, y, ...)
  end
  1. Pick a BDF font (Look for one on the Internet or take one from the fixtures folder on this project)
  {:ok, font} = Chisel.Font.load("foo/bar/font.bdf")
  1. Use Chisel to sculpt the text using the provided function and font
  Chisel.Renderer.draw_text("Hello World!", x, y, font, put_pixel)
  1. Enjoy!

Demo

(Thanks to lawik for the picture)

General purpose

Chisel is a general purpose library that can be used to render text on any target based on pixels (LCD, Led matrixs, image files, ...).

Render on an image with :egd

  img = :egd.create(200, 50)
  color = :egd.color({0, 0, 0})

  put_pixel = fn x, y ->
    :egd.line(img, {x, y}, {x, y}, color)
  end

  {:ok, font} = Chisel.Font.load("font.bdf")

  Chisel.Renderer.draw_text("Hello World!", 0, 0, font, put_pixel)

  :egd.save(:egd.render(img, :png), "test.png")

Render ASCII art

  put_pixel = fn x, y ->
    [{x, y} | pixels]
  end

  {:ok, font} = Chisel.Font.load("c64.bdf")

  {pixels, _, _} = Chisel.Renderer.reduce_draw_text("Hello World!", 0, 0, font, [], put_pixel)

  for y <- 0..10 do
    for x <- 0..100 do
      if Enum.member?(pixels, {x, y}) do
        "%"
      else
        " "
      end
    end
    |> IO.puts()
  end

Result:

                                                                                                     
                                                                                                     
 %%  %%                                          %%   %%                                   %%        
 %%  %%           %%%     %%%                    %%   %%                  %%%        %%    %%        
 %%  %%   %%%%     %%      %%     %%%%           %%   %%  %%%%   %%%%%     %%        %%    %%        
 %%%%%%  %%  %%    %%      %%    %%  %%          %% % %% %%  %%  %%  %%    %%     %%%%%    %%        
 %%  %%  %%%%%%    %%      %%    %%  %%          %%%%%%% %%  %%  %%        %%    %%  %%              
 %%  %%  %%        %%      %%    %%  %%          %%% %%% %%  %%  %%        %%    %%  %%              
 %%  %%   %%%%    %%%%    %%%%    %%%%           %%   %%  %%%%   %%       %%%%    %%%%%    %%        
                                                                                                     
                                                                                                     

Samples using OLED

OLED Demo

Using the right font it is even possible to render unicode strings.

Many good BDF fonts are available here on the U8g2 library repo.

Check fonts licenses here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].