forked from pwaller/pyfiglet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
105 lines (76 loc) · 4.23 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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 GPL (see LICENSE below).
Q. I improved this code, what should I do with it?
A. You can mail patches to <[email protected]>. Particularly bugfixes.
If you make changes to the kerning/mushing/rendering portion, PLEASE
test it throroughly. The code is fragile and complex.
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')
pyfiglet also supports reading fonts from a zip archive. pyfiglet
comes with a file called fonts.zip which includes all of the default
fonts FIGlet comes with as well as the standard collection of user-
contributed fonts. By default, pyfiglet uses this for fonts. Specifying
a directory (on the commandline or in the Figlet() object) will override
this behavior. You may also specify a zipfile to use with -z or zipfile=PATH
in the Figlet() constructor.
If you wish to add/remove fonts or create your own font package, be aware
that there *must* be a folder in the root of the zipfile called "fonts". You
can examine the bunlded fonts.zip to see how it should be packaged.
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/).
LICENSE
Copyright (C) 2007 Christopher Jones <[email protected]>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
(see LICENSE for full details)