figlet is a pure-Java library and Maven plugin for rendering text as ASCII art, powered by classic FIGfont (.flf) and TOIlet (.tlf) fonts — no native figlet binary, no external tools, works anywhere a JVM runs.
░█▀▀░▀█▀░█▀▀░█░░░█▀▀░▀█▀
░█▀▀░░█░░█░█░█░░░█▀▀░░█░
░▀░░░▀▀▀░▀▀▀░▀▀▀░▀▀▀░░▀░
-
Pure Java, no third-party runtime dependencies —
figlet4jonly pulls in its own bundled font resources; runs anywhere a JVM does. -
A huge font collection, built in — 146 FIGfonts bundled by default, plus 400+ more via the optional
figlet-fonts-xeromodule. -
Maven-native —
figlet-maven-pluginprints a banner straight into your build log; it runs once per multi-module reactor, not once per module. -
Markup DSL — mix several fonts and literal, unrendered text in a single banner, with Maven
${...}property placeholder support. -
Word-wrap & kerning — automatic word-wrapping at a configurable width, with glyphs fitted together instead of separated by ragged whitespace.
-
High test coverage — JUnit 5 + AssertJ across the parser, renderer, font loader and every Mojo.
| Module | Description |
|---|---|
figlet4j |
Pure Java library for rendering text using FIGfonts (.flf) and TOIlet fonts (.tlf) |
figlet-fonts-figletorg |
146 standard FIGfont resources collected from figlet.org |
figlet-fonts-xero |
400+ additional FIGfonts and TOIlet fonts from the xero/figlet-fonts repository |
figlet-maven-plugin |
Maven plugin — print ASCII art banners during your build |
- To use
figlet-maven-plugin: Maven 3.6.0+ and any JVM — the published artifacts target Java 11 bytecode. - To use
figlet4jas a standalone library: Java 11 or higher. - To build this project from source: JDK 17+ and Maven 3.9.0+ (enforced by the build itself; the compiled artifacts still target Java 11).
Add to your pom.xml:
<plugin>
<groupId>io.github.spannm</groupId>
<artifactId>figlet-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<content>${project.name} ${project.version}</content>
<font>chunky</font>
</configuration>
</plugin>Maven (pom.xml)
<dependency>
<groupId>io.github.spannm</groupId>
<artifactId>figlet4j</artifactId>
<version>1.0.0</version>
</dependency>Gradle (Groovy / build.gradle)
implementation 'io.github.spannm:figlet4j:1.0.0'Gradle (Kotlin DSL / build.gradle.kts)
implementation("io.github.spannm:figlet4j:1.0.0")FigletFont font = FigletFontLoader.loadBuiltin("standard");
FigletRenderer renderer = new FigletRenderer(font).withWidth(100);
System.out.println(renderer.render("Hello World"));Or mix multiple fonts and plain text during a Maven build with the markup DSL below.
| Goal | Default phase | Description |
|---|---|---|
figlet:render |
validate |
Renders ASCII art to the build log |
figlet:list-fonts |
(none) | Lists all available fonts with metadata |
figlet:help |
(none) | Shows usage and credits |
Note: In a multi-module reactor build,
figlet:renderonly executes for the execution-root project (the module Maven was invoked on) and silently does nothing for every other module — even if the plugin is bound in a child module's ownpom.xml. This avoids printing the same banner once per module.
| Parameter | Property | Default | Description |
|---|---|---|---|
content |
figlet.content |
${project.name} |
Content to render; supports ${...} property placeholders and the markup DSL to mix multiple fonts with plain text |
font |
figlet.font |
standard |
Name of a built-in font (see figlet:list-fonts) |
fontFile |
figlet.fontFile |
(none) | Path to an external .flf or .tlf file; takes precedence over font when both are set |
width |
figlet.width |
72 |
Max output width; long lines wrap at word boundaries |
strict |
figlet.strict |
true |
Fail if the content contains characters not supported by the font, or a ${...} placeholder cannot be resolved |
target |
figlet.target |
info |
Where to write the banner: info, debug, stdout, or stderr |
skip |
figlet.skip |
false |
Skip this goal entirely |
| Parameter | Property | Default | Description |
|---|---|---|---|
metadata |
figlet.metadata |
false |
Load every font and print its metadata comment block (author, date, …) |
sample |
figlet.sample |
false |
Render a short ASCII-art sample for every listed font |
sampleText |
figlet.sampleText |
(random) | Custom sample text; defaults to a varied, always-renderable fallback |
skip |
figlet.skip |
false |
Skip this goal entirely |
content may mix ASCII-art banners in different fonts with literal, unrendered text:
<content><![CDATA[
<figletFont name="standard">${project.name}</figletFont><lineBreak/>
<figletFont name="small">${project.version}</figletFont><lineBreak/>
built by ${user.name}
]]></content><figletFont name="...">...</figletFont>— enclosed text is rendered as ASCII art using the named built-in font.<lineBreak/>— an explicit line break, independent of font or automatic word-wrapping.<preserveWhitespace>...</preserveWhitespace>— enclosed text is emitted verbatim (leading/trailing whitespace and blank lines kept), unlike plain text which is trimmed.- Everything else is literal text, printed as-is.
- If
contentcontains no<figletFont>tag at all, the whole (resolved) content is rendered as a single banner usingfont/fontFile— exactly as if it had been wrapped in one<figletFont>tag referencing that font.
Run mvn figlet:list-fonts to browse every font on your classpath — add -Dfiglet.sample=true to render a live sample of each one.
Font files retain their original licenses — see the
LICENSE.txtin eachfiglet-fonts-*module for details.
git clone --recurse-submodules https://github.com/spannm/figlet.git
cd figlet
mvnNote: The project uses a Git submodule (
figlet-fonts-xero) for its extended font collection. Make sure to clone with--recurse-submodules, or rungit submodule update --init --recursiveafter cloning.
Got a bug to fix or a feature to add?
- Check out the Issues
- Fork the repo
- Submit a Pull Request
Note: Please ensure your code follows the project's quality standards (Checkstyle and Error Prone are enforced during the build).
figlet is licensed under the Apache License, Version 2.0.
Font files retain their original licenses. See the respective LICENSE.txt or notice files within the font resource modules for detailed third-party licensing information.
- FIGlet — Glenn Chappell, Ian Chai, Frank Sheeran (1991) — https://www.figlet.org
- TOIlet — Sam Hocevar (2006) — localhost/libcaca TOIlet tools (Sub-set specification support)
- FIGfont spec — John Cowan, Paul Burton (1996/1997)
- jfiglet — Lajos Puskas, inspired by Benoît Rigaut's CERN implementation
|
Enjoying figlet? Please leave a 🌟 to support the project! Your stars help others discover the project and keep it maintained. |