Commit f7233e6f authored by SVN-Git Migration's avatar SVN-Git Migration

Imported Upstream version 0.6.1+dfsg

parent 5f8ebb30
include pyfiglet/fonts/*.flf
.TH PYFIGLET "1" "June 2011" "pyfiglet 0.6" "User Commands"
.SH NAME
pyfiglet \- display text in large ASCII art fonts.
.SH SYNOPSIS
.B pyfiglet.py
[\fIoptions\fR] \fItext\fR...
.SH DESCRIPTION
pyFIGlet is a program that creates large characters out of ordinary
screen characters.
It takes ASCII text (\fItext\fR) and renders it in ASCII art fonts.
.P
This version of pyfiglet supports FIGlet fonts \fB.flf\fR and
the FIGlet-compatible toilet-fonts \fB.tlf\fR.
.SH OPTIONS
.TP
\fB\-\-version\fR
show program's version number and exit
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-f\fR \fIFONT\fR, \fB\-\-font\fR=\fIFONT\fR
font to render with (default: future)
.TP
\fB\-D\fR \fIDIRECTION\fR, \fB\-\-direction\fR=\fIDIRECTION\fR
set direction text will be formatted in (default:
auto)
.TP
\fB\-j\fR \fISIDE\fR, \fB\-\-justify\fR=\fISIDE\fR
set justification, defaults to print direction
.TP
\fB\-w\fR \fICOLS\fR, \fB\-\-width\fR=\fICOLS\fR
set terminal width for wrapping/justification
(default: 80)
.TP
\fB\-r\fR, \fB\-\-reverse\fR
shows mirror image of output text
.TP
\fB\-F\fR, \fB\-\-flip\fR
flips rendered output text over
.SH "SEE ALSO"
.BR toilet (1),
.BR figlet (1)
......@@ -10,7 +10,7 @@ import re
import sys
from optparse import OptionParser
__version__ = '0.6'
__version__ = '0.6.1dev'
__author__ = 'Peter Waller <peter.waller@gmail.com>'
__copyright__ = """
Copyright (C) 2007 Christopher Jones <cjones@gruntle.org>
......@@ -108,13 +108,13 @@ class FigletFont(object):
header = data.pop(0)
if self.reMagicNumber.search(header) is None:
raise FontError, '%s is not a valid figlet font' % self.font
raise FontError('%s is not a valid figlet font' % self.font)
header = self.reMagicNumber.sub('', header)
header = header.split()
if len(header) < 6:
raise FontError, 'malformed header for %s' % self.font
raise FontError('malformed header for %s' % self.font)
hardBlank = header[0]
height, baseLine, maxLength, oldLayout, commentLines = map(int, header[1:6])
......@@ -166,8 +166,8 @@ class FigletFont(object):
self.chars[i] = chars
self.width[i] = width
except Exception, e:
raise FontError, 'problem parsing %s font: %s' % (self.font, e)
except Exception as e:
raise FontError('problem parsing %s font: %s' % (self.font, e))
def __str__(self):
return '<FigletFont object: %s>' % self.font
......@@ -304,19 +304,21 @@ class FigletRenderingEngine(object):
lineRight = curChar[row]
if self.base.direction == 'right-to-left':
lineLeft, lineRight = lineRight, lineLeft
try:
linebd = len(lineLeft.rstrip()) - 1
if linebd < 0: linebd = 0
linebd = len(lineLeft.rstrip()) - 1
if linebd < 0:
linebd = 0
if linebd < len(lineLeft):
ch1 = lineLeft[linebd]
except:
else:
linebd = 0
ch1 = ''
try:
charbd = len(lineRight) - len(lineRight.lstrip())
charbd = len(lineRight) - len(lineRight.lstrip())
if charbd < len(lineRight):
ch2 = lineRight[charbd]
except:
else:
charbd = len(lineRight)
ch2 = ''
......@@ -337,13 +339,12 @@ class FigletRenderingEngine(object):
Render an ASCII text string in figlet
"""
self.curCharWidth = self.prevCharWidth = 0
buffer = []
buffer = ['' for i in range(self.base.Font.height)]
for c in map(ord, list(text)):
if self.base.Font.chars.has_key(c) is False: continue
curChar = self.base.Font.chars[c]
self.curCharWidth = self.base.Font.width[c]
if len(buffer) == 0: buffer = ['' for i in range(self.base.Font.height)]
maxSmush = self.smushAmount(buffer=buffer, curChar=curChar)
# Add a character to the buffer and do smushing/kerning
......@@ -356,19 +357,21 @@ class FigletRenderingEngine(object):
for i in range(0, maxSmush):
try: left = addLeft[len(addLeft) - maxSmush + i]
except: left = ''
idx = len(addLeft) - maxSmush + i
if idx >= 0 and idx < len(addLeft):
left = addLeft[idx]
else:
left = ''
right = addRight[i]
smushed = self.smushChars(left=left, right=right)
try:
l = list(addLeft)
l[len(l)-maxSmush+i] = smushed
l = list(addLeft)
idx = len(l)-maxSmush+i
if idx >= 0 and idx < len(l):
l[idx] = smushed
addLeft = ''.join(l)
except:
pass
buffer[row] = addLeft + addRight[maxSmush:]
......
......@@ -3,12 +3,12 @@
from setuptools import setup
setup(name='pyfiglet',
version='0.6',
version='0.6.1',
description='Pure-python FIGlet implementation',
author='Peter Waller (Thanks to Christopher Jones and Stefano Rivera)',
author_email='peter.waller@gmail.com',
url='https://github.com/pwaller/pyfiglet',
packages=['pyfiglet', 'pyfiglet.fonts'],
package_data={'pyfiglet.fonts' : ['pyfiglet/fonts/*.flf']},
package_data={'pyfiglet.fonts' : ['*.flf']},
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment