Renders text using large ASCII art fonts.
Supports multiple font styles with 1 or 2 color channels. Font data is sourced from the MIT-licensed cfonts project.
Summary
Functions
Compute the rendered dimensions of text in a given font.
Get the font data map for a given font name.
Get the height (number of lines) for a font.
Parse color tags from a font glyph row string.
Render text to plain lines (color tags stripped).
Render text to color-segmented rows.
Types
Functions
@spec dimensions(String.t(), font_name()) :: {non_neg_integer(), non_neg_integer()}
Compute the rendered dimensions of text in a given font.
Returns {width, height} where width is the sum of first-row
grapheme widths plus letterspace gaps between characters.
Get the font data map for a given font name.
@spec font_height(font_name()) :: non_neg_integer()
Get the height (number of lines) for a font.
@spec parse_color_tags(String.t()) :: [{String.t(), non_neg_integer()}]
Parse color tags from a font glyph row string.
"<c1>██</c1><c2>╗</c2>" → [{"██", 0}, {"╗", 1}]
Untagged text gets color_index 0.
Render text to plain lines (color tags stripped).
Returns a list of strings, one per font line.
@spec render_to_segments(String.t(), font_name()) :: [ [{String.t(), non_neg_integer()}] ]
Render text to color-segmented rows.
Returns a list of rows, where each row is a list of {text, color_index} segments.
Color index 0 = primary color, 1 = secondary color.