figlet-rs
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 ;
Output:
_ _ _ _ ____ _
| | | | ___| | | ___ | _ \ _ _ ___| |_
| |_| |/ _ \ | |/ _ \ | |_) | | | / __| __|
| _ | __/ | | (_) | | _ <| |_| \__ \ |_
|_| |_|\___|_|_|\___/ |_| \_\\__,_|___/\__|
_____ _
|_ _|__ __| |_
| |/ -_|_-< _|
|_|\___/__/\__|
_______ _
|__ __| | |
| | ___ ___| |_
| |/ _ \/ __| __|
| | __/\__ \ |_
|_|\___||___/\__|
______ __
/_ __/__ _____/ /_
/ / / _ \/ ___/ __/
/ / / __(__ ) /_
/_/ \___/____/\__/
▀▛▘ ▗▜ ▐
▌▞▀▖▄▐ ▞▀▖▜▀
▌▌ ▌▐▐ ▛▀ ▐ ▖
▘▝▀ ▀▘▘▝▀▘ ▀
▄▄▄▄▄▄▄▄
▀▀▀██▀▀▀ ██
██ ▄████▄ ▄▄█████▄ ███████
██ ██▄▄▄▄██ ██▄▄▄▄ ▀ ██
██ ██▀▀▀▀▀▀ ▀▀▀▀██▄ ██
██ ▀██▄▄▄▄█ █▄▄▄▄▄██ ██▄▄▄
▀▀ ▀▀▀▀▀ ▀▀▀▀▀▀ ▀▀▀▀
╺┳╸┏━╸┏━┓╺┳╸
┃ ┣╸ ┗━┓ ┃
╹ ┗━╸┗━┛ ╹
Test
▄▄▄▄▄▄▄ ▄
█ ▄▄▄ ▄▄▄ ▄▄█▄▄
█ █▀ █ █ ▀ █
█ █▀▀▀▀ ▀▀▀▄ █
█ ▀█▄▄▀ ▀▄▄▄▀ ▀▄▄
Load A Font File
use ;
The FIGlet output matches:
The Toilet output matches:
Built-in Fonts
The crate bundles these fonts as built-in APIs:
FIGlet:
FIGlet::standard()loadsresources/standard.flfFIGlet::small()loadsresources/small.flfFIGlet::big()loadsresources/big.flfFIGlet::slant()loadsresources/slant.flf
Toilet:
Toilet::smblock()loadsresources/smblock.tlfToilet::mono12()loadsresources/mono12.tlfToilet::future()loadsresources/future.tlfToilet::wideterm()loadsresources/wideterm.tlfToilet::mono9()loadsresources/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:
If you want to refresh the Toilet fixtures on a machine that already has toilet, run:
License
rs-figlet is distributed under the terms of the Apache License (Version 2.0).
See LICENSE-APACHE and COPYRIGHT for details.