Java implementation of FIGfonts ( to create ascii art banners




Java implementation of FIGfonts to create ascii art banners. My goals were:

  • distributed as a maven dependency
  • should be small

I started out from Benoît Rigaut, Juillet work found at


figlet is a command-line tool which helps you to create ascii banners like this:

     _  _____  ___   ____  _      _____  _____
    | ||  ___||_ _| / ___|| |    | ____||_   _|
 _  | || |_    | | | |  _ | |    |  _|    | |  
| |_| ||  _|   | | | |_| || |___ | |___   | |  
 \___/ |_|    |___| \____||_____||_____|  |_|  

Figlet has a specification which is included into the repo for easy access here


you can use it from command line or from java code

Maven dependency

add the following maven dependency to your pom.xml


Usage - code

Then one could use number of convertOneLine(...) static methods to do the magic

import com.github.lalyos.jfiglet.FigletFont;

public class App {
  public static void main(String[] args) {
    // using default font standard.flf, obtained from maven artifact
    String asciiArt1 = FigletFont.convertOneLine("hello");
    // using font font2.flf, located somewhere in classpath under path /flf/font2.flf
    String asciiArt2 = FigletFont.convertOneLine(FigletFont.class.getResourceAsStream("/flf/font2.flf"), "hello");
    asciiArt2 = FigletFont.convertOneLine("classpath:/flf/font2.flf", "hello");     
    // using font font3.flf, located in file system under path /opt/font3.flf
    String asciiArt3 = FigletFont.convertOneLine(new File("/opt/font3.flf"), "hello");     

    asciiArt3 = FigletFont.convertOneLine("/opt/font3.flf", "hello");     

    // using font font4.flf, from www 
    String asciiArt4 = FigletFont.convertOneLine("", "hello");     

Usage - command line

You can use the jar from the central repo, or use the latest development version from sourcecode;

Usage: java -jar jfiglet.jar [-f FLF] MESSAGE
Prints MESSAGE to stdout as ASCII art using Figlet font
Example: java -jar jfiglet.jar -f "/opt/myfont.flf" "Hello World"

Figlet font:
  -f  FLF is font file location within file system, java classpath or www.
      When FLF starts with `http://'|`https://' file will be fetched from WWW,
      if FLF starts from `classpath:' then it will be looked for in JRE classpath,
      otherwise FLF if path to file in file system

from source

git clone
cd jfiglet
mvn exec:java -Dexec.arguments="jfiglet rulez"

from maven central

curl -o jfiglet.jar
java -jar jfiglet.jar "text to convert"

Related projects

First I wrapped which is based on the artii gem I found 2 java implementations:


  • smush-ing: kerning is already implemented as default, smushing needs some coding.
  • add more fonts: first i wanted to keep it small, but want to deliver a couple of fonts included in the jar, or maybe as a separate maven dependency