Liking cljdoc? Tell your friends :D

clj-figlet.core

Native Clojure FIGlet implementation. Parses FIGfont files and renders text as ASCII art FIGures. See figfont.txt §CREATING FIGFONTS for the full specification.

This is the top-level public API namespace. Require this namespace to access all user-facing functions:

(require '[clj-figlet.core :as fig])

;; One-shot — pass a font name: (print (fig/render "standard" "Hello"))

;; Load once, render many — pass a font map: (def font (fig/load-font "fonts/small.flf")) (print (fig/render font "Hello")) (print (fig/render font "World"))

Native Clojure FIGlet implementation.
Parses FIGfont files and renders text as ASCII art FIGures.
See figfont.txt §CREATING FIGFONTS for the full specification.

This is the top-level public API namespace.  Require this namespace to
access all user-facing functions:

  (require '[clj-figlet.core :as fig])

  ;; One-shot — pass a font name:
  (print (fig/render "standard" "Hello"))

  ;; Load once, render many — pass a font map:
  (def font (fig/load-font "fonts/small.flf"))
  (print (fig/render font "Hello"))
  (print (fig/render font "World"))
raw docstring

clj-figlet.font

FIGfont Version 2 file parsing and loading.

A FIGfont file (.flf) is a plain text file containing the graphical arrangements of sub-characters that compose each FIGcharacter. This namespace handles every stage of reading one into a Clojure map: header parsing, layout parameter interpretation, comment skipping, endmark stripping, and extraction of both the 102 required FIGcharacters (ASCII 32-126 plus 7 Deutsch) and any code-tagged extras.

The font map returned by load-font is a plain Clojure map — no custom types or protocols — so fonts compose naturally with the rest of the language: they can be merged, filtered, assoc'd with overrides, serialized, or passed through any data pipeline.

See figfont.txt §CREATING FIGFONTS for the full specification.

FIGfont Version 2 file parsing and loading.

A FIGfont file (.flf) is a plain text file containing the graphical
arrangements of sub-characters that compose each FIGcharacter.  This
namespace handles every stage of reading one into a Clojure map:
header parsing, layout parameter interpretation, comment skipping,
endmark stripping, and extraction of both the 102 required
FIGcharacters (ASCII 32-126 plus 7 Deutsch) and any code-tagged
extras.

The font map returned by `load-font` is a plain Clojure map — no
custom types or protocols — so fonts compose naturally with the rest
of the language: they can be merged, filtered, assoc'd with overrides,
serialized, or passed through any data pipeline.

See figfont.txt §CREATING FIGFONTS for the full specification.
raw docstring

clj-figlet.render

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.
raw docstring

clj-figlet.smushing

Horizontal smushing rules for FIGlet rendering.

The FIGfont spec defines six controlled smushing rules, each governing how a specific class of sub-character pair collapses when two FIGcharacters overlap by one column. A font's layout parameter selects which subset of these rules is active — so the rules must be individually addressable.

Each rule is implemented as a pure function of (left, right, hardblank) returning the smushed character or nil, and the six functions are collected in a dispatch map keyed by rule number. This mirrors the spec's enumerated structure directly: rule 1 has code value 1, rule 2 has code value 2, and so on. The public entry point h-try-smush walks only the rules active for the current font and returns the first match, or falls back to universal smushing when no controlled rules are configured.

See figfont.txt §Smushing Rules.

Horizontal smushing rules for FIGlet rendering.

The FIGfont spec defines six controlled smushing rules, each governing
how a specific class of sub-character pair collapses when two
FIGcharacters overlap by one column.  A font's layout parameter
selects which subset of these rules is active — so the rules must be
individually addressable.

Each rule is implemented as a pure function of (left, right, hardblank)
returning the smushed character or nil, and the six functions are
collected in a dispatch map keyed by rule number.  This mirrors the
spec's enumerated structure directly: rule 1 has code value 1, rule 2
has code value 2, and so on.  The public entry point `h-try-smush`
walks only the rules active for the current font and returns the first
match, or falls back to universal smushing when no controlled rules
are configured.

See figfont.txt §Smushing Rules.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close