5
|
1 |
###############################################################################
|
|
2 |
#
|
|
3 |
# ReportLab Public License Version 1.0
|
|
4 |
#
|
|
5 |
# Except for the change of names the spirit and intention of this
|
|
6 |
# license is the same as that of Python
|
|
7 |
#
|
|
8 |
# (C) Copyright ReportLab Inc. 1998-2000.
|
|
9 |
#
|
|
10 |
#
|
|
11 |
# All Rights Reserved
|
|
12 |
#
|
|
13 |
# Permission to use, copy, modify, and distribute this software and its
|
|
14 |
# documentation for any purpose and without fee is hereby granted, provided
|
|
15 |
# that the above copyright notice appear in all copies and that both that
|
|
16 |
# copyright notice and this permission notice appear in supporting
|
7
|
17 |
# documentation, and that the name of ReportLab not be used
|
5
|
18 |
# in advertising or publicity pertaining to distribution of the software
|
|
19 |
# without specific, written prior permission.
|
|
20 |
#
|
|
21 |
#
|
|
22 |
# Disclaimer
|
|
23 |
#
|
|
24 |
# ReportLab Inc. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
|
25 |
# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
|
|
26 |
# IN NO EVENT SHALL ReportLab BE LIABLE FOR ANY SPECIAL, INDIRECT
|
|
27 |
# OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
28 |
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
29 |
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
30 |
# PERFORMANCE OF THIS SOFTWARE.
|
|
31 |
#
|
|
32 |
###############################################################################
|
|
33 |
# $Log: stdfonts.py,v $
|
7
|
34 |
# Revision 1.2 2000/02/15 17:55:59 rgbecker
|
|
35 |
# License text fixes
|
5
|
36 |
#
|
7
|
37 |
# Revision 1.1.1.1 2000/02/15 15:15:57 rgbecker
|
|
38 |
# Initial setup of demos directory and contents.
|
|
39 |
#
|
|
40 |
__version__=''' $Id: stdfonts.py,v 1.2 2000/02/15 17:55:59 rgbecker Exp $ '''
|
5
|
41 |
# standardfonts.py
|
|
42 |
#
|
|
43 |
# shows the 14 standard fonts in our encoding
|
|
44 |
|
|
45 |
from pdfbase import pdfmetrics
|
|
46 |
from pdfgen import canvas
|
|
47 |
|
|
48 |
def run():
|
|
49 |
|
|
50 |
canv = canvas.Canvas('standardfonts.pdf')
|
|
51 |
canv.setPageCompression(0)
|
|
52 |
|
|
53 |
for fontname in pdfmetrics.StandardEnglishFonts:
|
|
54 |
canv.setFont('Times-Bold', 18)
|
|
55 |
canv.drawString(80, 744, fontname)
|
|
56 |
|
|
57 |
#for dingbats, we need to use another font for the numbers.
|
|
58 |
#do two parallel text objects.
|
|
59 |
if fontname == 'ZapfDingbats':
|
|
60 |
labelfont = 'Helvetica'
|
|
61 |
else:
|
|
62 |
labelfont = fontname
|
|
63 |
|
|
64 |
for byt in range(32, 256):
|
|
65 |
col, row = divmod(byt - 32, 32)
|
|
66 |
x = 72 + (66*col)
|
|
67 |
y = 720 - (18*row)
|
|
68 |
canv.setFont(labelfont, 14)
|
|
69 |
canv.drawString(x, y, '%d =' % byt)
|
|
70 |
canv.setFont(fontname, 14)
|
|
71 |
canv.drawString(x + 44, y , chr(byt))
|
|
72 |
|
|
73 |
canv.showPage()
|
|
74 |
|
|
75 |
|
|
76 |
canv.save()
|
|
77 |
|
|
78 |
if __name__ == '__main__':
|
|
79 |
run()
|