class

AsciiArt::Renderer

Inherits Reference < Object

Renders a string into a multi-line ASCII art banner using a FlfFont. v0.1 implements the simplest layout — full-width juxtaposition with no smushing, no kerning. This always produces a readable result; the only cost is a slightly wider banner than what figlet itself would produce in default mode.

Smushing (the FIGlet algorithm that overlaps adjacent glyphs to tighten letter spacing) is documented for v0.2.

Constructors

new(font : FlfFont)
Source

Instance methods

render(text : String) : String

Renders text and returns it as a single string with \n between lines, ready to print. Unknown characters fall back to a blank glyph (so they leave a gap rather than crash).

Source
render_lines(text : String) : Array(String)

Renders text and returns the array of lines (one entry per row of the banner). Useful for callers that want to colourise the output, frame it, or measure its bounding box.

Source
width(text : String) : Int32

Returns the width of the rendered banner in characters, without actually rendering. Cheap to call repeatedly.

Source