Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Get all the usable fonts in pyfiglet python3

I am using a library called pyfiglet which i installed using pip3 install pyfiglet i want to know if there is a way through which i can get a list of all the fonts which i can use in pyfiglet.figlet_format() like i want to get a list list_of_fonts = [] and in the list i want to get all of the fonts which i can use or which are installed.

I am using Debian Linux with Python 3.9

Thanks for answering in advance.

like image 698
Aditya Avatar asked Oct 15 '25 16:10

Aditya


2 Answers

Type this in terminal, it will show all the fonts you can use.

pyfiglet -l  

or

pyfiglet --list_fonts

In a python file, you can get a fonts list:

import pyfiglet
print(pyfiglet.FigletFont.getFonts())
like image 69
Jacky Avatar answered Oct 18 '25 06:10

Jacky


Adding to @Jacky's answer, if you'd want to visualize how each fonts look, you can run the below for loop.

for FONTS in `pyfiglet -l`; do echo $FONTS; pyfiglet $FONTS -f $FONTS; done;

You can pipe the output to a file for later references.

like image 35
vijay Avatar answered Oct 18 '25 05:10

vijay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!