Skip to content

religiosa1/figaro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Figaro is a program for making large letters out of ordinary text

It's a rewrite of figlet to rust

It renders text like this:

    _____
   / __(_)___ _____ __________
  / /_/ / __ `/ __ `/ ___/ __ \
 / __/ / /_/ / /_/ / /  / /_/ /
/_/ /_/\__, /\__,_/_/   \____/
      /____/

It supports most of figlet features, including:

  • loading flf2 and tlf2 font files (with optional zip support)
  • loading flc control files
  • all layout modes including smushing, overlap
  • right-to-Left input modes
  • text-justification and paragraph mode (not sure why you need it though)

Additionally it introduces a single-line mode, completely disabling word wraps and line-breaks.

It doesn't support non-unicode input methods. It doesn't support vertical and supersmushing either (the same way as Figlet 2.2 does not, only FIGWin 1.0 does).

Building the cli:

To simply build the project run from the repo root:

cargo build -p figaro-cli --release

You can customize the default font directory and default font name used by the program by supplying env variables during the compilation.

Variable default value
DEFAULT_FONT_DIR Linux: /usr/share/figlet
MacOS: /usr/local/share/figlet
Windows: C:\Program Files\figlet
DEFAULT_FONT standard

Example:

DEFAULT_FONT_DIR="/usr/share/figaro" DEFAULT_FONT=banner cargo build -p figaro-cli --release

Use as a library

figaro can be used as a standalone rust library as well or compiled as WASM. See figaro folder, or look into main to see how it can be used.

Differences from figlet

  • support for non-unicode input methods is dropped (it's 21-st century now);
  • support for a separate German mode dropped as well. All languages are equal, use unicode;
  • clear control flag -N is not supported (just don't provide bad controls)
  • Infocode support is also dropped, there's a different -I/--info flag instead, which prints similar information similar to figlet infocodes instead
  • Font information flag -F/--fontinfo displays information about the used font file (size, amount of chars, layout, print direction, etc.)
  • in RTL writing mode, it's not trying to back-load the word wrap, wrapping words in the usual manner line-by-line, for example:
-w 40 -R "foo bar baz"

will be:

               __                   ____
   _________ _/ /_     ____  ____  / __/
  / ___/ __ `/ __ \   / __ \/ __ \/ /_
 / /  / /_/ / /_/ /  / /_/ / /_/ / __/
/_/   \__,_/_.___/   \____/\____/_/

                                    __
                       ____  ____ _/ /_
                      /_  / / __ `/ __ \
                       / /_/ /_/ / /_/ /
                      /___/\__,_/_.___/

and not:

                                   ____
                      ____  ____  / __/
                     / __ \/ __ \/ /_
                    / /_/ / /_/ / __/
                    \____/\____/_/

               __                  __
  ____  ____ _/ /_     _________ _/ /_
 /_  / / __ `/ __ \   / ___/ __ `/ __ \
  / /_/ /_/ / /_/ /  / /  / /_/ / /_/ /
 /___/\__,_/_.___/  /_/   \__,_/_.___/

Downloading fonts:

This repo doesn't contain any fonts, and they are required for the operation. Unless DEFAULT_FONT_DIR was provided at build time, Figaro tries to use figlet font dir path on your system. If you don't have any figlet fonts installed on your system, you can grab them from the website FTP link.

Font warnings

By default, when parsing a font, Figaro CLI outputs to STDERR warnings about font, such as empty lines in a font character, or inconsistent character line width, but no more than 30 warnings per font file. This functionality can be disabled with --silent flag. Alternatively, if you want to display all warnings you can provide --all-warnings flag.

License

Figaro is MIT licensed.

About

Figlet clone written in Rust

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages