#ascii-art #ascii

no-std figlet-rs

Rust implementation of FIGlet to create ascii art

8 releases (1 stable)

1.0.0 Mar 12, 2026
0.2.0 Mar 12, 2026
0.1.5 Feb 14, 2023
0.1.4 Oct 2, 2022
0.1.2 Jun 23, 2019

#6 in No standard library

Download history 2725/week @ 2025-12-23 3389/week @ 2025-12-30 3834/week @ 2026-01-06 4220/week @ 2026-01-13 3699/week @ 2026-01-20 3955/week @ 2026-01-27 4331/week @ 2026-02-03 3294/week @ 2026-02-10 3719/week @ 2026-02-17 4184/week @ 2026-02-24 4904/week @ 2026-03-03 5420/week @ 2026-03-10 4863/week @ 2026-03-17 5891/week @ 2026-03-24 5169/week @ 2026-03-31 5517/week @ 2026-04-07

22,508 downloads per month
Used in 117 crates (89 directly)

Apache-2.0

155KB
1K SLoC

Contains (Zip file, 65KB) resources/mono12.tlf, (Zip file, 48KB) resources/mono9.tlf

figlet-rs

CI docs crates.io

A Rust library for FIGlet and Toilet fonts to generate ascii art.

The default rendering behavior follows the font's built-in FIGlet layout settings, including horizontal kerning and smushing. The current output is tested against fixtures generated from local figlet and toilet binaries, but running tests does not require either tool to be installed.

Example

use figlet_rs::{FIGlet, Toilet};

fn main() {
    let standard_font = FIGlet::standard().unwrap();
    let small_font = FIGlet::small().unwrap();
    let big_font = FIGlet::big().unwrap();
    let slant_font = FIGlet::slant().unwrap();
    let smblock_font = Toilet::smblock().unwrap();
    let mono12_font = Toilet::mono12().unwrap();
    let future_font = Toilet::future().unwrap();
    let wideterm_font = Toilet::wideterm().unwrap();
    let mono9_font = Toilet::mono9().unwrap();

    println!("{}", standard_font.convert("Hello Rust").unwrap());
    println!("{}", small_font.convert("Test").unwrap());
    println!("{}", big_font.convert("Test").unwrap());
    println!("{}", slant_font.convert("Test").unwrap());
    println!("{}", smblock_font.convert("Toilet").unwrap());
    println!("{}", mono12_font.convert("Test").unwrap());
    println!("{}", future_font.convert("Test").unwrap());
    println!("{}", wideterm_font.convert("Test").unwrap());
    println!("{}", mono9_font.convert("Test").unwrap());
}

Output:

 _   _      _ _         ____            _
| | | | ___| | | ___   |  _ \ _   _ ___| |_
| |_| |/ _ \ | |/ _ \  | |_) | | | / __| __|
|  _  |  __/ | | (_) | |  _ <| |_| \__ \ |_
|_| |_|\___|_|_|\___/  |_| \_\\__,_|___/\__|


 _____       _
|_   _|__ __| |_
  | |/ -_|_-<  _|
  |_|\___/__/\__|


 _______        _
|__   __|      | |
   | | ___  ___| |_
   | |/ _ \/ __| __|
   | |  __/\__ \ |_
   |_|\___||___/\__|



  ______          __
 /_  __/__  _____/ /_
  / / / _ \/ ___/ __/
 / / /  __(__  ) /_
/_/  \___/____/\__/


▀▛▘  ▗▜    ▐
 ▌▞▀▖▄▐ ▞▀▖▜▀
 ▌▌ ▌▐▐ ▛▀ ▐ ▖
 ▘▝▀ ▀▘▘▝▀▘ ▀


 ▄▄▄▄▄▄▄▄
 ▀▀▀██▀▀▀                        ██
    ██      ▄████▄   ▄▄█████▄  ███████
    ██     ██▄▄▄▄██  ██▄▄▄▄ ▀    ██
    ██     ██▀▀▀▀▀▀   ▀▀▀▀██▄    ██
    ██     ▀██▄▄▄▄█  █▄▄▄▄▄██    ██▄▄▄
    ▀▀       ▀▀▀▀▀    ▀▀▀▀▀▀      ▀▀▀▀



╺┳╸┏━╸┏━┓╺┳╸
 ┃ ┣╸ ┗━┓ ┃
 ╹ ┗━╸┗━┛ ╹

Test


▄▄▄▄▄▄▄                 ▄
   █     ▄▄▄    ▄▄▄   ▄▄█▄▄
   █    █▀  █  █   ▀    █
   █    █▀▀▀▀   ▀▀▀▄    █
   █    ▀█▄▄▀  ▀▄▄▄▀    ▀▄▄


Load A Font File

use figlet_rs::{FIGlet, Toilet};

fn main() {
    let figlet_font = FIGlet::from_file("resources/small.flf").unwrap();
    let toilet_font = Toilet::from_file("resources/smblock.tlf").unwrap();

    println!("{}", figlet_font.convert("Test").unwrap());
    println!("{}", toilet_font.convert("Toilet").unwrap());
}

The FIGlet output matches:

figlet -f resources/small.flf Test

The Toilet output matches:

toilet -d resources -f smblock.tlf Toilet

Built-in Fonts

The crate bundles these fonts as built-in APIs:

FIGlet:

  • FIGlet::standard() loads resources/standard.flf
  • FIGlet::small() loads resources/small.flf
  • FIGlet::big() loads resources/big.flf
  • FIGlet::slant() loads resources/slant.flf

Toilet:

  • Toilet::smblock() loads resources/smblock.tlf
  • Toilet::mono12() loads resources/mono12.tlf
  • Toilet::future() loads resources/future.tlf
  • Toilet::wideterm() loads resources/wideterm.tlf
  • Toilet::mono9() loads resources/mono9.tlf

Use FIGlet::from_file(...) to load custom .flf files.

Use Toilet::from_file(...) to load custom .tlf files, including zip-packaged .tlf files.

Testing

Fixtures live in tests/fixtures. They are committed to the repository so cargo test stays stable in environments without local figlet or toilet binaries.

If you want to refresh the FIGlet fixtures on a machine that already has figlet, run:

./scripts/generate_figlet_fixtures.sh

If you want to refresh the Toilet fixtures on a machine that already has toilet, run:

./scripts/generate_toilet_fixtures.sh

License

rs-figlet is distributed under the terms of the Apache License (Version 2.0).

See LICENSE-APACHE and COPYRIGHT for details.

Dependencies

~1.5MB
~25K SLoC