• Stars
    star
    1,283
  • Rank 35,136 (Top 0.8 %)
  • Language
    Python
  • License
    Other
  • Created over 13 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An implementation of figlet written in Python

pyfiglet

                        _|_|  _|            _|              _|
_|_|_|    _|    _|    _|            _|_|_|  _|    _|_|    _|_|_|_|
_|    _|  _|    _|  _|_|_|_|  _|  _|    _|  _|  _|_|_|_|    _|
_|    _|  _|    _|    _|      _|  _|    _|  _|  _|          _|
_|_|_|      _|_|_|    _|      _|    _|_|_|  _|    _|_|_|      _|_|
_|              _|                      _|
_|          _|_|                    _|_|

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 [cjones] 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 thoroughly. 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 #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.

  • Q: Why are some fonts missing in distribution?

    A: Some Linux distributions have very strict legal restrictions on what contributions they will take. For these systems, we have divided the fonts into ones that have a clear redistribution license and those that don't. These are the fonts-standard and fonts-contrib directories in this repository.

  • Q: What about those other fonts?

    A: While there isn't a watertight case for the license, we believe that any legal constraint for these fonts has long expired and so they are public domain, so are continuing to redistribute via pypi. If an owner of any of these fonts wants us to stop, please just raise an issue on https://github.com/pwaller/pyfiglet/issues proving your ownership and we will remove the requested fonts.

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'))

or

import pyfiglet
f = pyfiglet.figlet_format("text to render", font="slant")
print(f)

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

All of the documentation and the majority of the work done was by Christopher Jones ([email protected]) and many other contributors. Packaged by Peter Waller ([email protected]), various enhancements by Stefano Rivera ([email protected]), and lots of help from many contributors!

Thank you all for your efforts, please send a pull request to add yourself to this list if you would like to take credit.

(In the words of the original 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

Lots of people have helped make pyfiglet what it is but I particularly want to call out.

github:stefanor for various bug fixes and improvements and the debian packaging. github:peterbrittain for helping to close lots of issues.

License

The MIT License (MIT) Copyright Β© 2007-2023

Christopher Jones <[email protected]>
Stefano Rivera <[email protected]>
Peter Waller <[email protected]>
And various contributors (see git history).

(see LICENSE for full details)

Packaging status

Packaging status

More Repositories

1

goupx

Fix golang compiled binaries on x86_64 so that they can be packed with UPX
Go
334
star
2

docker-show-context

Show where time is wasted during the context upload of `docker build`
Go
323
star
3

go2ll-talk

Live coding a basic Go compiler with LLVM in 20 minutes
Go
265
star
4

pyprof2calltree

Profile python programs and view them with kcachegrind
Python
156
star
5

goimports-update-ignore

Generate .goimportsignore and make goimports fast
Go
64
star
6

go-ffmpeg-video-encoding

Basic bindings for ffmpeg video encoding
Go
22
star
7

perf

Linux Perf subsystem bindings for Go
Go
21
star
8

go2ll

Extremely experimental toy go compiler
Go
19
star
9

waitsilence

an executable which blocks until it receives nothing on stdin for a specified time
Go
18
star
10

sharedextents

Show proportion of physical extents shared between two files
Go
12
star
11

zerocopy

go zerocopy.Reader interface and implementation
Go
11
star
12

go-clz4

fast cgo implementation of lz4
C
10
star
13

fienode

Discover identical CoW copies, analogous to an inode
Go
10
star
14

cartographer

Quickly find non-determinism bugs caused by loops over maps
Go
9
star
15

sha1-visualizer

Visualize SHA1 bit differences
JavaScript
7
star
16

usv

Go
7
star
17

iptables-block-dns

Block distractions by dropping DNS packets
Shell
5
star
18

git-minecraft-smudge

(defunct) Abusing git's filter mechanism for fun and profit.
Go
4
star
19

httpcache

{non,}Transparent MITM http{,s} proxy
Go
4
star
20

pp2g

Crude python to go translator
Python
3
star
21

binview

A fun pointless visualization of arbitrary binary files
Python
3
star
22

__autoversion__

Python
3
star
23

git-alot

Track the status of many git repositories
Python
3
star
24

go-hexcolor

golang Hex string color model
Go
2
star
25

jump

Jump to AWS machines
Go
2
star
26

gooda

C
2
star
27

minty

Python
2
star
28

wscat

cat. For websockets.
Go
2
star
29

bumphunter.pw

Simple implementation of the BumpHunter algorithm
Python
1
star
30

static-fusermount

Makefile
1
star
31

pwa

Python
1
star
32

barrier

Signalling primitive for golang
Go
1
star
33

inf

Infinity
Python
1
star
34

go-memhelper

Helper functions for avoiding OOM with many goroutines doing memory-heavy things
Go
1
star
35

runlocal

communicate commands to be run from remote to local over x-forwarding
Go
1
star
36

ptrace-read

Go
1
star
37

httpservecache

Golang HTTP server caching middleware using groupcache
Go
1
star
38

fastwalk

Go
1
star
39

https-redirect

Redirect traffic from port 80 to 443
Go
1
star
40

keyboard

Keyboard offers a universal keyboard shortcut binding interface for various backends.
Go
1
star
41

go-ping

Go
1
star