Copyright | © Patrick Pelletier 2017 |
---|---|
License | BSD3 |
Maintainer | code@funwithsoftware.org |
Safe Haskell | None |
Language | Haskell2010 |
Given a Unicode code point, returns a glyph made up of 5x8 dots. Only supports characters which are made up of a single code point. (In other words, combining marks are not supported.)
Uses the 5x8 fixed font,
originally from the X Window System. This font is in the public domain.
The font is stored in a compact binary representation in the file
5x8.lcd
, which is automatically loaded (via unsafePerformIO
)
when needed.
- getCharacter :: Char -> Maybe [Word8]
- showCharacter :: Char -> [String]
- charFromAsciiArt :: [String] -> [Word8]
Documentation
getCharacter :: Char -> Maybe [Word8] Source #
Looks up the given character, and returns the 5x8 bitmap
for the character. If the character is not found in the font,
returns Nothing
. If the character is found, returns a list
of eight bytes, one for each row of the glyph. Within each byte,
the least significant five bits contain the five dots for that row.
This is the format expected by the HD44780 for custom characters.
showCharacter :: Char -> [String] Source #
A quick and dirty way to visualize characters in the font. Given a character, returns the glyph as ASCII art.
charFromAsciiArt :: [String] -> [Word8] Source #
Converts a glyph from ASCII art to binary representation. Expects a list of eight lines, where each line contains five characters. A dot is considered "off" if the character is a space, or "on" if it is any other character. Returns the glyph in the format expected for custom characters: eight bytes where each byte contains data in the least significant five bits.