Table of Contents
TheDraw font parser and console text renderer. This utility was inspired by the tdfiglet
CLI utility. I wanted to also use the fonts in another utility I am working on.
tdfiglet
was missing some features and the ability to use more than a single font per file. I realized there was multiple fonts with different color schemes in some of them as well as font packs containing files with lots of different fonts within one font file.
- Render TheDraw fonts in the terminal
- Supports COLOR font types only as they are more plentiful and cooler looking
- Configure spacing between characters, the size a
- Use a random font for content
- Supported characters and a missing character view available when listing fonts to find a font that contains the necessary characters.
print
- use arguments or stdin as the text content to renderwatch
- specify a command to repeat and render the output (clocks, status, live banner)clock
- alias to printdate +%H:%m:%S
to the console (tmux lock, console clock)./tdfgo clock
fonts
- dump the list of fonts available with information about the font and coloring previews./tdfgo fonts -v
- Preview fonts when dumping the list with customizable content
./tdfgo fonts -vp -t text
- Shell completion of all flags and commands, completion of font file names found, completion of fonts found within a single font file
Screenshots
[?] Please provide your screenshots here.
Zsh / Bash / Fish Completion | Font Dump Verbose with Preview |
---|---|
Go 1.18 Neovim Arch Linux
Go 1.18
[?] Clone the repo and get started
git clone https://github.com/digitallyserviced/tdfgo.git
cd tdfgo
go build
./tdfgo fonts -vp -t YOURTEXT
The utility searches Font Directories for available fonts. Launch the utility from the cloned directory or copy fonts into one of the defined directories to be able to use them from anywhere.
I plan to get an installer going soon.
-w, --columns int Specify the amount of columns or width that the text will be rendered into (default 80)
-f, --font string Specify font to use for TEXT if multiple uses first (default "mindstax")
-i, --fontIndex int If multiple fonts per file specify the index of the font to use (default 0)
-h, --help help for tdfgo
-j, --justify string Specify the justification for rendered content, computes padding if necessary given current terminal width. {left, center, justify} (default "left")
-m, --monochrome Render text in monochrome by stripping color escape sequences. Will then be using the default foreground color
-r, --random Use a random font as the selected font when rendering text content
-W, --spaceWidth int Set the spacing for a space character in the text provided (default 3)
-s, --spacing int Override the fonts own specified spacing used between characters. (default -1)
-v, --verbose Print more information about fonts
Using the selected font and specified options output a clock to the terminal
# Center the clock using the yazoox font and use font #4 (0 based index)
tdfgo -j center -f yazoox -i 3 clock
Run a command every # interval and use the output as the text rendered using a font
tdfgo watch [-i interval] CMD args... [flags]
# console clock
tdfgo watch -n 1s 'date "+%H:%m:%S"'
tdfgo clock
# print ONLINE or OFFLINE based off ping success
tdfgo watch 'ping -c1 -w 1 google.com>/dev/null 2>&1 && echo -n ONLINE || echo -n OFFLINE'
# print 1min load avg every 0.5 seconds
tdfgo watch 'cat /proc/loadavg | cut -d" " -f 1'
-h, --help help for watch
-n, --interval duration Interval between executions of the specified command (default 1s)
List all available fonts found in the default directories
tdfgo fonts [-v] [-p] [-t text] [-X] [pattern]
# list fonts with impact in name
tdfgo fonts impact
# list fonts with much more information
tdfgo fonts -v
# list fonts with a preview output using default string "Preview"
tdfgo fonts -p
# list fonts with information about required characters specified by -t
# useful to find fonts having all the characters you need
tdfgo fonts -p -X -t "!@#$JDKALFK@{}"
-X, --checkChars Check fonts to see if they are missing any characters in the defined preview text
-h, --help help for fonts
-p, --preview Output a preview for the fonts
-t, --text string Sample string to use for previewing fonts (default "Preview")
.
./fonts
/usr/share/tdfgo/fonts
/usr/local/share/tdfgo/fonts
~/.config/tdfgo/fonts
- Built-in (There are two fonts
mindstax.tdf
andyazoox.tdf
embedded within the binary for use anywhere)
Reach out to the maintainer at one of the following places:
- GitHub issues
- Contact options listed on this GitHub profile
If you want to say thank you or/and support active development of TDFGO:
- Add a GitHub Star to the project.
- Tweet about the TDFGO.
- Write interesting articles about the project on Dev.to, Medium or your personal blog.
Together, we can make TDFGO better!
First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.
The original setup of this repository is by DigitallyServiced.
For a full list of all authors and contributors, see the contributors page.
This project is licensed under the Creative Commons.
See LICENSE for more information.
https://github.com/tat3r/tdfiglet