LinuxCommandLibrary

figlet

Create large, ASCII art text banners

TLDR

Generate by directly inputting text

$ figlet [input_text]
copy

Use a custom [f]ont file
$ figlet -f [path/to/font_file.flf] [input_text]
copy

Use a [f]ont from the default font directory (the extension can be omitted)
$ figlet -f [font_filename] [input_text]
copy

Pipe command output through FIGlet
$ [command] | figlet
copy

Show available FIGlet fonts
$ showfigfonts [optional_string_to_display]
copy

Use the full width of the [t]erminal and [c]enter the input text
$ figlet -t -c [input_text]
copy

Display all characters at full [W]idth to avoid overlapping
$ figlet -W [input_text]
copy

SYNOPSIS

figlet [ options ] [ text ]
options can include:
  -f fontfile Use a specific font.
  -d directory Specify a font directory.
  -w width Set the output width.
  -t Set output width to terminal width.
  -c Center the output.
  -l Left justify the output.
  -r Right justify the output.
  -p Paragraph justify the output.
  -s Smush characters (default).
  -k Kerning (no smushing, but less space).
  -x Smush using old rules.
  -m smushmode Direct smush mode.
  -o outputfile Write output to a file.
  -I List available fonts.
  -D Display font information.
text is the string to convert. If omitted, figlet reads from standard input.

PARAMETERS

-f fontfile
    Uses the specified font file (e.g., 'standard.flf') located in the font path. The font file extension (.flf or .tlf) is often omitted.

-d directory
    Specifies a directory to search for font files. This overrides or augments the default font search path.

-w width
    Sets the maximum output width for the generated text. If not specified, it defaults to 80 characters or terminal width if -t is used.

-t
    Sets the maximum output width to the current terminal width. This is particularly useful for dynamic terminal environments.

-c
    Centers the output horizontally within the specified or default width.

-l
    Left-justifies the output text.

-r
    Right-justifies the output text.

-p
    Paragraph-justifies the output. This tries to justify each line of text within the overall output block.

-s
    Enables 'smushing,' where adjacent characters are merged horizontally if possible, reducing overall width. This is the default behavior.

-k
    Enables 'kerning,' which places adjacent characters as close as possible without overlapping, but without actual merging. This usually results in wider output than smushing.

-x
    Enables 'smushing' using an older, less sophisticated set of rules. This might be used for backward compatibility with older font designs.

-m smushmode
    Directly specifies the smush mode by a numerical value, offering finer control over character merging rules.

-o outputfile
    Writes the generated ASCII art to the specified outputfile instead of standard output.

-I
    Prints a list of all available font files found in the configured font directories.

-D
    Displays detailed information about the default font, including its smushing rules and capabilities.

DESCRIPTION

figlet is a versatile command-line utility designed to generate large letters from ordinary text, transforming it into striking ASCII art banners. It achieves this by utilizing a wide array of specialized font files, each defining the character outlines for various artistic styles. Users can customize the output extensively, controlling aspects like justification (left, right, center, paragraph), output width, and "smushing" rules—how adjacent characters are compressed or merged to save space or enhance aesthetics. Commonly employed for decorative purposes, figlet output is often seen in shell scripts, motd (message of the day) files, READMEs, or simple text-based presentations. Its ease of use and rich font library make it a popular choice for adding a visual flair to plain text environments.

CAVEATS

figlet's output quality heavily depends on the chosen font file; some fonts may not render well with all text or terminal settings.
Complex character sets or multi-byte characters (e.g., Unicode) might not be fully supported by all fonts or older figlet versions, leading to incorrect or missing output.
The 'smushing' and 'kerning' algorithms can sometimes produce visually undesirable results, especially with certain character combinations or fonts not designed for heavy smushing.
The default output width and terminal size can also affect how banners are displayed, potentially causing wrapping or truncation.

FONT FILES AND DIRECTORIES

figlet fonts are typically stored as .flf or .tlf files (FIGlet Font or TOIlet Font) in system-wide directories such as /usr/share/figlet or /usr/local/share/figlet. Users can specify custom font directories using the -d option or by setting the FIGLET_FONTDIR environment variable.

SMUSHING AND KERNING

These terms refer to how figlet handles the horizontal spacing between characters. Smushing attempts to merge overlapping parts of adjacent characters to reduce width, while kerning simply minimizes the space between characters without merging. The default behavior is smushing (-s), but users can choose kerning (-k) or disable it entirely (-o with older versions or specific smush modes). Different fonts define their own smushing rules, which dictate how characters can be combined.

HISTORY

figlet was originally authored by Glenn Chappell and Ian Chai in 1991, with the primary goal of creating a simple yet powerful tool for generating ASCII art banners. Its development was driven by the desire for a command-line utility that could produce large, stylized text without the need for graphic design software. Over the years, it has been maintained and enhanced by various developers, including Russell Stuart, Frank Scheffold, and others.

Since its inception, figlet has gained widespread popularity in Unix-like environments, becoming a standard utility for creating motd (message of the day) files, decorating shell scripts, or adding a distinctive visual element to terminal output. Its extensible font system contributed significantly to its longevity and versatility, allowing users to create and share custom font designs.

SEE ALSO

toilet(1), banner(6), man(1)

Copied to clipboard