defmodule CanvasCraft.Text.Pixel5x7 do
  @moduledoc false
  # 5x7 pixel font, rows top->bottom, '1' is filled pixel
  @font %{
    ?A => ["01110","10001","10001","11111","10001","10001","10001"],
    ?B => ["11110","10001","11110","10001","10001","10001","11110"],
    ?C => ["01111","10000","10000","10000","10000","10000","01111"],
    ?D => ["11110","10001","10001","10001","10001","10001","11110"],
    ?E => ["11111","10000","11110","10000","10000","10000","11111"],
    ?F => ["11111","10000","11110","10000","10000","10000","10000"],
    ?G => ["01111","10000","10000","10111","10001","10001","01111"],
    ?H => ["10001","10001","11111","10001","10001","10001","10001"],
    ?I => ["11111","00100","00100","00100","00100","00100","11111"],
    ?J => ["00001","00001","00001","00001","10001","10001","01110"],
    ?K => ["10001","10010","11100","10010","10010","10001","10001"],
    ?L => ["10000","10000","10000","10000","10000","10000","11111"],
    ?M => ["10001","11011","10101","10001","10001","10001","10001"],
    ?N => ["10001","11001","10101","10011","10001","10001","10001"],
    ?O => ["01110","10001","10001","10001","10001","10001","01110"],
    ?P => ["11110","10001","10001","11110","10000","10000","10000"],
    ?Q => ["01110","10001","10001","10001","10101","10010","01101"],
    ?R => ["11110","10001","10001","11110","10010","10001","10001"],
    ?S => ["01111","10000","10000","01110","00001","00001","11110"],
    ?T => ["11111","00100","00100","00100","00100","00100","00100"],
    ?U => ["10001","10001","10001","10001","10001","10001","01110"],
    ?V => ["10001","10001","10001","10001","10001","01010","00100"],
    ?W => ["10001","10001","10001","10101","10101","11011","10001"],
    ?X => ["10001","10001","01010","00100","01010","10001","10001"],
    ?Y => ["10001","10001","01010","00100","00100","00100","00100"],
    ?Z => ["11111","00001","00010","00100","01000","10000","11111"],
    ?0 => ["01110","10011","10101","10101","11001","10001","01110"],
    ?1 => ["00100","01100","00100","00100","00100","00100","01110"],
    ?2 => ["01110","10001","00001","00010","00100","01000","11111"],
    ?3 => ["11110","00001","00001","01110","00001","00001","11110"],
    ?4 => ["00010","00110","01010","10010","11111","00010","00010"],
    ?5 => ["11111","10000","11110","00001","00001","10001","01110"],
    ?6 => ["01110","10000","11110","10001","10001","10001","01110"],
    ?7 => ["11111","00001","00010","00100","01000","10000","10000"],
    ?8 => ["01110","10001","10001","01110","10001","10001","01110"],
    ?9 => ["01110","10001","10001","01111","00001","00001","01110"],
    ?: => ["00000","00100","00000","00000","00100","00000","00000"],
    ?. => ["00000","00000","00000","00000","00000","00100","00100"],
    ?- => ["00000","00000","00000","01110","00000","00000","00000"],
    ?\s => ["00000","00000","00000","00000","00000","00000","00000"]
  }

  def glyph(ch) do
    Map.get(@font, ch, Map.fetch!(@font, ?\s))
  end
end
