Linocut.Font (Linocut v0.1.3)

Copy Markdown View Source

A three-by-five pixel font for names, numbers and notes drawn onto a picture.

Linocut.Font.render("SCORE 120", :white)
Linocut.Font.render("alice", {255, 220, 0}, scale: 2)

Every printable ASCII character has a glyph; lowercase letters draw as capitals and any other character as a box. Glyphs are laid out with one transparent pixel between them, so a text is width/1 pixels across and five tall before scaling.

Summary

Functions

The five rows of a character's glyph, # for a lit pixel.

The text as a raster in colour; option :scale, a whole factor (default 1).

How many pixels across text renders, before scaling.

Functions

glyph(char)

@spec glyph(String.t()) :: [String.t()]

The five rows of a character's glyph, # for a lit pixel.

render(text, colour, opts \\ [])

The text as a raster in colour; option :scale, a whole factor (default 1).

width(text)

@spec width(String.t()) :: non_neg_integer()

How many pixels across text renders, before scaling.