Drafter.Widget.Digits.Bitmap (drafter v0.3.1)

Copy Markdown View Source

The glyph shapes behind the rasterised fonts in Drafter.Widget.Digits.Font.

Each character is one 8×16 pixel bitmap: seven columns of shape and one of side bearing, twelve rows of shape between a row of ascender space and three of leading. Cap height is ten rows, leaving two for the descenders on , and ;.

Drafter.Widget.Digits.Raster downsamples these bitmaps into the :tall, :pixel and :braille fonts. See the large text guide.

In the source shapes, # is an ink pixel and . is paper.

Examples

iex> Drafter.Widget.Digits.Bitmap.width()
8

iex> Drafter.Widget.Digits.Bitmap.height()
16

iex> Drafter.Widget.Digits.Bitmap.drawable?("Q")
true

iex> Drafter.Widget.Digits.Bitmap.drawable?("\u2603")
false

iex> Drafter.Widget.Digits.Bitmap.pixels("\u2603")
MapSet.new([])

Summary

Functions

Every character with a bitmap, sorted.

Whether a character has a bitmap in some case.

Pixel height of every bitmap, ascender space and leading included.

The lit pixels of a character as a MapSet of {x, y}, origin top left.

Pixel width of every bitmap, side bearing included.

Functions

characters()

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

Every character with a bitmap, sorted.

drawable?(character)

@spec drawable?(String.t()) :: boolean()

Whether a character has a bitmap in some case.

height()

@spec height() :: pos_integer()

Pixel height of every bitmap, ascender space and leading included.

pixels(character)

@spec pixels(String.t()) :: MapSet.t({non_neg_integer(), non_neg_integer()})

The lit pixels of a character as a MapSet of {x, y}, origin top left.

Returns an empty set for a character with no bitmap.

width()

@spec width() :: pos_integer()

Pixel width of every bitmap, side bearing included.