Rendering engine for FIGlet text.
FIGcharacters are assembled left-to-right into an output buffer — a vector of strings, one per row. The core operation is computing how far each new FIGcharacter can slide left into the buffer before visible sub-characters collide, then merging the overlap region according to the font's layout mode:
:full — no overlap; characters sit at their full designed width. :fitting — slide until characters touch (no visible overlap). :smushing — slide one column further and apply smushing rules at the single junction point where visible sub-characters meet.
The merge of each row is expressed as three string regions — left (buffer only), overlap (merged), right (new character only) — rather than a column-by-column loop, so the hot path stays in Clojure string operations without mutable state.
Hardblanks are opaque during layout (they prevent characters from sliding through) but are replaced with spaces in the final output.
See figfont.txt §Layout Modes, §Hardblanks.
Rendering engine for FIGlet text.
FIGcharacters are assembled left-to-right into an output buffer — a
vector of strings, one per row. The core operation is computing how
far each new FIGcharacter can slide left into the buffer before
visible sub-characters collide, then merging the overlap region
according to the font's layout mode:
:full — no overlap; characters sit at their full designed width.
:fitting — slide until characters touch (no visible overlap).
:smushing — slide one column further and apply smushing rules at
the single junction point where visible sub-characters
meet.
The merge of each row is expressed as three string regions — left
(buffer only), overlap (merged), right (new character only) — rather
than a column-by-column loop, so the hot path stays in Clojure string
operations without mutable state.
Hardblanks are opaque during layout (they prevent characters from
sliding through) but are replaced with spaces in the final output.
See figfont.txt §Layout Modes, §Hardblanks.(render font-or-name text)Renders text as a FIGure. The first argument may be:
load-font)load-font (filesystem path, File, Reader)Returns a string containing the rendered ASCII art, terminated by a newline.
Each input character is looked up in the font's :chars map by its character code. If a character is not present in the font, FIGcharacter code 0 (the font's "missing character") is used as a fallback; if that is also absent, the character is silently omitted.
FIGcharacters are assembled left-to-right using the font's default horizontal layout mode (:full, :fitting, or :smushing) and its configured smushing rules. Hardblank sub-characters are replaced with spaces in the final output, and trailing whitespace is trimmed from each line.
Renders text as a FIGure. The first argument may be:
- A font map (as returned by `load-font`)
- A font name string (e.g. "standard"), which loads the bundled font
from resources/fonts/<name>.flf
- Any other source accepted by `load-font` (filesystem path, File, Reader)
Returns a string containing the rendered ASCII art, terminated by a
newline.
Each input character is looked up in the font's :chars map by its
character code. If a character is not present in the font, FIGcharacter
code 0 (the font's "missing character") is used as a fallback; if that
is also absent, the character is silently omitted.
FIGcharacters are assembled left-to-right using the font's default
horizontal layout mode (:full, :fitting, or :smushing) and its
configured smushing rules. Hardblank sub-characters are replaced with
spaces in the final output, and trailing whitespace is trimmed from
each line.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |