All of the documentation and the majority of the work done was by
Christopher Jones ([email protected]).
Packaged by Peter Waller <[email protected]>,
various enhancements by Stefano Rivera <[email protected]>.
_|_| _| _| _|
_|_|_| _| _| _| _|_|_| _| _|_| _|_|_|_|
_| _| _| _| _|_|_|_| _| _| _| _| _|_|_|_| _|
_| _| _| _| _| _| _| _| _| _| _|
_|_|_| _|_|_| _| _| _|_|_| _| _|_|_| _|_|
_| _| _|
_| _|_| _|_|
SYNOPSIS
pyfiglet is a full port of FIGlet (http://www.figlet.org/) into pure
python. It takes ASCII text and renders it in ASCII art fonts (like
the title above, which is the 'block' font).
FAQ
Q. Why? WHY?!
A. I was bored. Really bored.
Q. What the hell does this do that FIGlet doesn't?
A. Not much, except allow your font collection to live
in one big zipfile. The point of this code is to embed
dynamic figlet rendering in Python without having to
execute an external program, although it operates on the
commandline as well. See below for USAGE details. You can
think of this as a python FIGlet driver.
Q. Does this support kerning/smushing like FIGlet?
A. Yes, yes it does. Output should be identical to FIGlet. If
not, this is a bug, which you should report to me!
Q. Can I use/modify/redstribute this code?
A. Yes, under the terms of the MIT (see LICENSE below).
Q. I improved this code, what should I do with it?
A. You can submit changes to https://github.com/pwaller/pyfiglet/pulls.
If you make changes to the kerning/mushing/rendering portion, PLEASE
test it throroughly. The code is fragile and complex.
Q. Where did my font go?
A. It turns out that we didn't have distribution rights for some of the
fonts and so we had to remove them. Full details of the change and
why we did it are in https://github.com/pwaller/pyfiglet/issues/59.
Q. Where can I find these and other fonts?
A. Do a quick search for "figlet fonts" on your favourite search engine
should give you what you need. However, if you are looking for the
specific removed fonts, please go to http://www.jave.de/figlet/fonts.html.
USAGE
You can use pyfiglet in one of two ways. First, it operates on the
commandline as C figlet does and supports most of the same options.
Run with --help to see a full list of tweaks. Mostly you will only
use -f to change the font. It defaults to standard.flf.
tools/pyfiglet 'text to render'
Pyfiglet is also a library that can be used in python code:
from pyfiglet import Figlet
f = Figlet(font='slant')
print f.renderText('text to render')
If you have found some new fonts that you want to use, you can use the
command line interface to install your font file as follows:
pyfiglet -L <font file>
The font file can be a ZIP file of lots of fonts or just a single font.
Depending on how you installed pyfiglet, you may find that you need
root access to install the font - e.g. `sudo pyfiglet -L <font file>`.
AUTHOR
pyfiglet is a *port* of FIGlet, and much of the code is directly translated
from the C source. I optimized some bits where I could, but because the smushing
and kerning code is so incredibly complex, it was safer and easier to port the logic
almost exactly. Therefore, I can't really take much credit for authorship, just
translation. The original authors of FIGlet are listed on their website at
http://www.figlet.org/.
The Python port was done by Christopher Jones <[email protected]> (http://gruntle.org/).
It is currently maintained by Peter Waller ([email protected], github:pwaller)
The toilet fonts (.tlf) were imported from toilet 0.3-1, by Sam Hocevar <[email protected]>.
THANKS
github:stefanor for various bug fixes and improvements and the debian packaging.
Thanks to anyone who contributed an issue or code on github!
LICENSE
The MIT License (MIT)
Copyright © 2007-2018
Christopher Jones <[email protected]>
Stefano Rivera <[email protected]>
Peter Waller <[email protected]>
And various contributors (see git history).
(see LICENSE for full details)
CHANGELOG
2018-12-06 0.8.0
#62 Change LICENSE to MIT
#61 Provide font installation option (-L) and remove
unlicenced fonts from the distribution
2018-10-17 0.7.6
#57 Implement colored print
#53 Allow fonts to be specified by path
2016-06-12 0.7.5
#46 Add 100+ fonts from java.de figlet fonts collection v4.0
#48 Include python3 in testing
2015-05-27 0.7.4
#43 Don't leak file handles
2015-04-14 0.7.3
#41 Add newline and text wrapping support
2014-09-14 0.7.2
#35 Add this CHANGELOG
#36 Bug fix for #34 (broken --reverse and --flip)
(reported "character mapping must return integer, None or unicode")
2014-07-27 0.7.1
#29 Fix for UTF8 regression
#31 Add __main__ entry point
#32 Pep8 the code and minor refactoring
#33 Trove classifiers update
2014-06-02 0.7
#9 Add --list_fonts and --info_font
#10 Add tools/pyfiglet_example for listing all fonts
#11 Fix the pyfiglet command (had bad python path)
#12 Pyflakes fixes
#13 Configure Travis Continuous Integration
#17 Documentation usage sample fix
#19 Enable pyfiglet to use extended ASCII chars
#20 Add two cyrillic fonts
#21 Python 3 support
#27 Code improvements
#28 Human readable font list (-l)
An implementation of figlet written in Python
Overview
Comments
-
Font Licensing
opened by LyesSaadi 57Hello :),
A while ago (nearly a year!), I submitted pyfiglet for inclusion in the Fedora repositories. It was approved, but its inclusion was aborted as I found out about all the fonts included and nearly fainted at the sight of reviewing each of these fonts licenses. In retrospect, I should've contacted you to help me with those issues, which is why I decided to do it now.
Indeed, today @peterbrittain found out by luck of our effort to package pyfiglet and let us know that all the fonts which were not distributable were removed (as per #59). That is great, but unfortunately not enough. Indeed, for Fedora, it is required that the license of each font is documented and shipped with its license. And this package has fonts... A lot of them... And most are undocumented.
I also found out thanks to @peterbrittain that there is prior art in FIGlet licensing in Fedora, and what I seem to take out from that discussion is that if the shape and appearance of the fonts themselves are Public Domain, the files still remain under a font license.
So, what needs to be done is the curation of each font file in this repository. What could also be done is the creation of a new repository containing non-free or lost fonts that users can add easily using
help wantedpyfiglet -L, while keeping safe fonts in the main repository. -
Alternatives to GPL-2.0 license?
opened by peterbrittain 42First off, I just wanted to say that I love that you've spent the time to port FIGlet to Python. This is a great project and I want to say thank you for creating it. But that's not why I've raised this issue... :-)
It turns out that many of your dependent projects/packages (https://github.com/pwaller/pyfiglet/network/dependents) are using pyfiglet, but are not redistributing under the terms of the GPL-2.0 license that you are using. My own package (https://github.com/peterbrittain/asciimatics) appears to have fallen foul of this.
I really want to continue to deploy my package under the terms of the Apache-2.0 license, which as I understand it means I have to follow one of the following options:
- Remove/replace the use of your package
- Convert all direct use of pyfiglet (via import) into separate process calls (via your command-line script).
- Agree with you (as the copyright holders) a separate license for my project.
- Persuade you to change your standard license to something that allows for this use case - e.g. LGPL-3.0.
Given how many other projects depend on this one (and are actually breaking the terms as I now understand them), I'd like to try to do the right thing here and explore options 3 and 4 with you before just diving into options 1 or 2.
So... Would you be willing to consider some other form of licensing like LGPL?
-
Add newline support
opened by grandemk 22Added carriage return support to pyfiglet refactored the FigletRenderingEngine: Use a Director - Builder - Product design pattern refactored test.py, tests are now easy to add. added a test_font script too diff fonts results with figlet added stats_erroneous_font.py based on test.py, show which font and type of smush value are failing the tests
If the width is smaller than a character width of the font, we throw an exception, get a bigger terminal with more than 6 columns :-) This is different from figlet which will either send many spaces or little part of the characters
Fixes #25.
-
Fonts don't have a suitable license for distribution
opened by pwaller 20Please see comments raised by @peterbrittain in https://github.com/pwaller/pyfiglet/issues/58#issuecomment-425883141 #58
In essence, I think we need to revert #46, or come to an understanding that distributing these is legitimate.
Paging @peterbrittain, @stefanor @asakasinsky (#20) @MinchinWeb (#46).
I could use some help figuring out what needs to be done here, I also don't have much free time for actioning this. Here is a quick first pass proposal:
- Identify fonts which need removing.
- (or equivalently, which can be kept, so that the code is self standing)
- Remove them from the github repository.
- Decode if they need removing from the history of the repository.
- Remove them from source distributions on PyPi.
- Decide if they need removing from older versions (if they should be removed from the repository
- Provide a mechanism for the user to obtain/use additional fonts from sources where the license is valid.
- Identify fonts which need removing.
-
Fix for #89 - clarify font licensing
opened by peterbrittain 12Hopefully this is everything we agreed...
- Fonts now separated out into 2 directories
- Makefule updated to make it easy to build minimal or full font definitions
- Docs updated to say what's happened.
I didn't go for the BDF files in the end as I wasn't so sure about the legality, while the other explicit license text was much more reassuring.
Are we good to go?
-
an unexpected keyword argument 'dir'?
opened by asakasinsky 7pyfiglet-0.6.1 from pip
>>> f = Figlet(dir=fontPath, font='slant') Traceback (most recent call last): File "<console>", line 1, in <module> TypeError: __init__() got an unexpected keyword argument 'dir' -
Implemented colored print
opened by mnunezdm 6Hi,
I just implemented this because I needed to use in a project and said, why not?
I added to keyword args into the print_figlet method
I also created a dictionary for storing the ASCII codes of the colors, and i created a method that converts the color passed to the escaped sequence
I also added to more params to the optparse, -c and -b
is my first time doing a PR so hope i do it right....
-
Thank you! ❤ your contribution to available Python packages....
opened by PySimpleGUI 5I don't see a sponsor button, so I'm going to at least say
M""""""""M dP dP Mmmm mmmM 88 88 MMMM MMMM 88d888b. .d8888b. 88d888b. 88 .dP MMMM MMMM 88' `88 88' `88 88' `88 88888" MMMM MMMM 88 88 88. .88 88 88 88 `8b. MMMM MMMM dP dP `88888P8 dP dP dP `YP MMMMMMMMMM M""MMMM""M dP M. `MM' .M 88 MM. .MM .d8888b. dP dP 88 MMMb dMMM 88' `88 88 88 dP MMMM MMMM 88. .88 88. .88 MMMM MMMM `88888P' `88888P' oo MMMMMMMMMMYou've made my code so much more enjoyable, fun, and provided the library that my GUI sits on top of. Without your code, there would be no figlets in my code.
Much happier code after finding
pyfiglet
-
More colours for output
opened by synergiator 5Using the
coloredmodule, you can access quite many colors available in the terminal.Is it anyhow possible to confugure
pyfigletto use color settings (as) provided by this module? -
Don't Leak File Handles
opened by llimllib 5In pypy, which is garbage collected rather than refcounted, open file handles can sometimes collect too quickly for the garbage collector and trigger the operating system's file handle limit.
In my test code, I was seeing this failure:
ERROR: Failure: IOError ([Errno 24] Too many open files: u'/Users/llimllib/.virtualenvs/limbopypy/site-packages/pyfiglet/fonts/stellar.flf') ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/nose/loader.py", line 414, in loadTestsFromName addr.filename, addr.module) File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/Users/llimllib/code/limbo/test/test_plugins/test_banner.py", line 10, in <module> from banner import on_message File "/Users/llimllib/code/limbo/test/test_plugins/../../limbo/plugins/banner.py", line 9, in <module> FONTS = FIGLET.getFonts() File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/pyfiglet/__init__.py", line 750, in getFonts return self.Font.getFonts() File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/pyfiglet/__init__.py", line 119, in getFonts if cls.isValidFont(font)] File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/pyfiglet/__init__.py", line 111, in isValidFont f = pkg_resources.resource_stream('pyfiglet.fonts', font) File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/pkg_resources/__init__.py", line 1161, in resource_stream self, resource_name File "/Users/llimllib/.virtualenvs/limbopypy/site-packages/pkg_resources/__init__.py", line 1715, in get_resource_stream return open(self._fn(self.module_path, resource_name), 'rb') IOError: [Errno 24] Too many open files: u'/Users/llimllib/.virtualenvs/limbopypy/site-packages/pyfiglet/fonts/stellar.flf'As soon as I patched pyfiglet's getFont method to close the file handle, all my tests passed.
I don't know much about pkg_resources, but the docs promise that the result of
resource_streamshould be a file-like object, and so .close() should be legal on it. -
Extraneous newlines
opened by aerickson 4Maybe trim to 1 newline at front and end?
Happy to work on this. Let me know what you think. Thanks for the project. :)
Example:
help wanted➜ /tmp pyfiglet -f doh 0 000000000 00:::::::::00 00:::::::::::::00 0:::::::000:::::::0 0::::::0 0::::::0 0:::::0 0:::::0 0:::::0 0:::::0 0:::::0 000 0:::::0 0:::::0 000 0:::::0 0:::::0 0:::::0 0:::::0 0:::::0 0::::::0 0::::::0 0:::::::000:::::::0 00:::::::::::::00 00:::::::::00 000000000 ➜ /tmp -
How to install fonts
opened by aeciobf 0I've try to install custom fonts, but the command returns error.
pyfiglet -L ansi_shadow Usage: pyfiglet [options] [text..] pyfiglet: error: no such option: -L
-
Lack of spaces with some fonts
opened by victorbnl 0With the font ANSI Regular, the output text lacks spaces between the letters. Which, that goes without saying, makes the text pretty much unreadable. The issue occurs only with pyfiglet and not figlet.

help wanted
-
New line after each formatted string
opened by G-us 0I'm trying to make a calculator, but I need to format different strings with different colors but when I add all the formatted strings together they each appear on a new line. I've been looking through the code for the library but can't find any thing that can help
Any ideas?
-
No "pyfiglet.fonts" module found
opened by The1TrueJoe 2I installed pyserial without the pip package manager. I could not get the SSL module to work on my Nvidia Jetson (ubuntu 14), so installing via pip was not an option. Instead, I cloned the repo and installed from the setup script.
This is not an issue when installing via pip on another computer (same python and pip versions).
Here are the commands I used:
git clone https://github.com/pwaller/pyfiglet cd pyfiglet sudo python3.7 setup.py installWhen I checked out the most recent release tag, it solved the issue. (I deleted the previous version from site-packages)
git clone https://github.com/pwaller/pyfiglet cd pyfiglet git checkout d7079e9 # Working version sudo python3.7 setup.py install
help wanted
-
Problem with standalone JupyterLab on Windows
opened by miklevin 1pyfiglet doesn't import. Here's the error:
import pyfiglet
KeyError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_17912/2380198760.py in
----> 1 import pyfiglet C:\JupyterLab\resources\jlab_server\lib\site-packages\pyfiglet_init_.py in
57 58 if sys.platform == 'win32': ---> 59 SHARED_DIRECTORY = os.path.join(os.environ["APPDATA"], "pyfiglet") 60 else: 61 SHARED_DIRECTORY = '/usr/local/share/pyfiglet/' C:\JupyterLab\resources\jlab_server\lib\os.py in getitem(self, key) 673 except KeyError: 674 # raise KeyError with the original key value --> 675 raise KeyError(key) from None 676 return self.decodevalue(value) 677
KeyError: 'APPDATA'
And here's the contents of os.environ
environ{'HOMEDRIVE': 'C:', 'HOMEPATH': '\Users\mike', 'JUPYTER_CONFIG_DIR': 'C:\Users\mike\AppData\Roaming\jupyterlab-desktop', 'JUPYTER_TOKEN': 'foo(removed)', 'LOGONSERVER': '\\LUNDERVAND', 'PATH': 'C:\JupyterLab\resources\jlab_server;C:\JupyterLab\resources\jlab_server\Library\mingw-w64\bin;C:\JupyterLab\resources\jlab_server\Library\usr\bin;C:\JupyterLab\resources\jlab_server\Library\bin;C:\JupyterLab\resources\jlab_server\Scripts;C:\JupyterLab\resources\jlab_server\bin;C:\Python39\Scripts\;C:\Python39\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\JupyterLab;C:\Users\mike\AppData\Local\Microsoft\WindowsApps;C:\Users\mike\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\mike\AppData\Roaming\npm', 'SYSTEMDRIVE': 'C:', 'SYSTEMROOT': 'C:\WINDOWS', 'TEMP': 'C:\Users\mike\AppData\Local\Temp', 'USERDOMAIN': 'LUNDERVAND', 'USERNAME': 'mike', 'USERPROFILE': 'C:\Users\mike', 'WINDIR': 'C:\WINDOWS', 'PYDEVD_USE_FRAME_EVAL': 'NO', 'JPY_INTERRUPT_EVENT': '2248', 'IPY_INTERRUPT_EVENT': '2248', 'JPY_PARENT_PID': '1996', 'TERM': 'xterm-color', 'CLICOLOR': '1', 'PAGER': 'cat', 'GIT_PAGER': 'cat', 'MPLBACKEND': 'module://matplotlib_inline.backend_inline'}
And here's the JupyterLab version (standalone / Electron app): Version 3.2.5-1
help wanted
Releases(0.7.3)
-
0.7.3(Apr 14, 2015)
See #41.
Source code(tar.gz)
Source code(zip)
-
0.7.2(Sep 14, 2014)
Fixes #34.
Source code(tar.gz)
Source code(zip)
Wikipedia Reader for the GNOME Desktop
Wike Wike is a Wikipedia reader for the GNOME Desktop. Provides access to all the content of this online encyclopedia in a native application, with a
Python flexible slugify function
awesome-slugify Python flexible slugify function PyPi: https://pypi.python.org/pypi/awesome-slugify Github: https://github.com/dimka665/awesome-slugif
You can encode and decode base85, ascii85, base64, base32, and base16 with this tool.
You can encode and decode base85, ascii85, base64, base32, and base16 with this tool.
py-trans is a Free Python library for translate text into different languages.
Free Python library to translate text into different languages.
Fuzzy string matching like a boss. It uses Levenshtein Distance to calculate the differences between sequences in a simple-to-use package.
Fuzzy string matching like a boss. It uses Levenshtein Distance to calculate the differences between sequences in a simple-to-use package.
🍋 A Python package to process food
Pyfood is a simple Python package to process food, in different languages. Pyfood's ambition is to be the go-to library to deal with food, recipes, on
Format Covid values to ASCII-Table (Only for Germany and Austria)
Covid-19-Formatter (Only for Germany and Austria) Dieses Script speichert die gemeldeten Daten des RKIs / BMSGPK und formatiert diese zu einer Asci Ta
一款高性能敏感词(非法词/脏字)检测过滤组件,附带繁体简体互换,支持全角半角互换,汉字转拼音,模糊搜索等功能。
一款高性能非法词(敏感词)检测组件,附带繁体简体互换,支持全角半角互换,获取拼音首字母,获取拼音字母,拼音模糊搜索等功能。
Deasciify-highlighted - A Python script for deasciifying text to Turkish and copying clipboard
deasciify-highlighted is a Python script for deasciifying text to Turkish and copying clipboard.
Hotpotato is a recipe portfolio App that assists users to discover and comment new recipes.
Hotpotato Hotpotato is a recipe portfolio App that assists users to discover and comment new recipes. It is a fullstack React App made with a Redux st
A collection of pre-commit hooks for handling text files.
texthooks A collection of pre-commit hooks for handling text files. In particular, hooks for handling unicode characters which may be undesirable in a
Map Reduce Wordcount in Python using gRPC
This project is implemented in Python using gRPC. The input files are given in .txt format and the word count operation is performed.
strbind - lapidary text converter for translate an text file to the C-style string
strbind strbind - lapidary text converter for translate an text file to the C-style string. My motivation is fast adding large text chunks to the C co
Maiden & Spell community player ranking based on tournament data.
MnSRank Maiden & Spell community player ranking based on tournament data. Why? 2021 just ended and this seemed like a cool idea. Elo doesn't work well
Python Q&A for Network Engineers
Q & A I am often asked questions about how to solve this or that problem, and I decided to post these questions and solutions here, in case it is also
Widevine KEY Extractor in Python
Widevine Client 3 This was originally written by T3rry7f. This repo is slightly modified version of his repo. This only works on standard Windows! Usa
Wikipedia Extractive Text Summarizer + Keywords Identification (entropy-based)
Wikipedia Extractive Text Summarizer + Keywords Identification (entropy-based)Wikipedia Extractive Text Summarizer + Keywords Identification (entropy-based)
A simple Python module for parsing human names into their individual components
Name Parser A simple Python (3.2+ & 2.6+) module for parsing human names into their individual components. hn.title hn.first hn.middle hn.last hn.suff
Repositori untuk belajar pemrograman Python dalam bahasa Indonesia
Python Repositori ini berisi kumpulan dari berbagai macam contoh struktur data, algoritma dan komputasi matematika yang diimplementasikan dengan mengg
PyNews 📰 Simple newsletter made with python 🐍🗞️
PyNews 📰 Simple newsletter made with python Install dependencies This project has some dependencies (see requirements.txt) that are not included in t