author | rptlab |
Tue, 30 Apr 2013 14:28:14 +0100 | |
branch | py33 |
changeset 3723 | 99aa837b6703 |
parent 3721 | 0c93dd8ff567 |
child 4252 | fe660f227cac |
permissions | -rw-r--r-- |
3617 | 1 |
#Copyright ReportLab Europe Ltd. 2000-2012 |
687
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
2 |
#see license.txt for license details |
2332 | 3 |
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfbase/_fontdata.py |
687
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
4 |
#$Header $ |
2332 | 5 |
__version__=''' $Id$ ''' |
3032 | 6 |
__doc__="""Database of font related things |
3031 | 7 |
|
3032 | 8 |
- standardFonts - tuple of the 14 standard string font names |
9 |
- standardEncodings - tuple of the known standard font names |
|
10 |
- encodings - a mapping object from standard encoding names (and minor variants) |
|
11 |
to the encoding vectors ie the tuple of string glyph names |
|
12 |
- widthsByFontGlyph - fontname x glyphname --> width of glyph |
|
13 |
- widthVectorsByFont - fontName -> vector of widths |
|
3332 | 14 |
|
15 |
This module defines a static, large data structure. At the request |
|
16 |
of the Jython project, we have split this off into separate modules |
|
17 |
as Jython cannot handle more than 64k of bytecode in the 'top level' |
|
18 |
code of a Python module. |
|
687
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
19 |
""" |
3723
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
20 |
import os, sys |
687
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
21 |
|
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
22 |
# mapping of name to width vector, starts empty until fonts are added |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
23 |
# e.g. widths['Courier'] = [...600,600,600,...] |
725 | 24 |
widthVectorsByFont = {} |
687
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
25 |
fontsByName = {} |
689
18104568afde
Changes to basic Font stuff, moved it to pdfmetrics
rgbecker
parents:
687
diff
changeset
|
26 |
fontsByBaseEnc = {} |
687
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
27 |
# this is a list of the standard 14 font names in Acrobat Reader |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
28 |
standardFonts = ( |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
29 |
'Courier', 'Courier-Bold', 'Courier-Oblique', 'Courier-BoldOblique', |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
30 |
'Helvetica', 'Helvetica-Bold', 'Helvetica-Oblique', 'Helvetica-BoldOblique', |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
31 |
'Times-Roman', 'Times-Bold', 'Times-Italic', 'Times-BoldItalic', |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
32 |
'Symbol','ZapfDingbats') |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
33 |
|
2216 | 34 |
standardFontAttributes = { |
35 |
#family, bold, italic defined for basic ones |
|
36 |
'Courier':('Courier',0,0), |
|
37 |
'Courier-Bold':('Courier',1,0), |
|
38 |
'Courier-Oblique':('Courier',0,1), |
|
39 |
'Courier-BoldOblique':('Courier',1,1), |
|
40 |
||
41 |
'Helvetica':('Helvetica',0,0), |
|
42 |
'Helvetica-Bold':('Helvetica',1,0), |
|
43 |
'Helvetica-Oblique':('Helvetica',0,1), |
|
44 |
'Helvetica-BoldOblique':('Helvetica',1,1), |
|
45 |
||
46 |
'Times-Roman':('Times-Roman',0,0), |
|
47 |
'Times-Bold':('Times-Roman',1,0), |
|
48 |
'Times-Italic':('Times-Roman',0,1), |
|
49 |
'Times-BoldItalic':('Times-Roman',1,1), |
|
50 |
||
51 |
'Symbol':('Symbol',0,0), |
|
52 |
'ZapfDingbats':('ZapfDingbats',0,0) |
|
53 |
||
54 |
} |
|
55 |
||
881 | 56 |
#this maps fontnames to the equivalent filename root. |
1981 | 57 |
_font2fnrMapWin32 = { |
2824
00671dc77c11
_fontdata.py: force all t1 defaults to be lowercase
rgbecker
parents:
2767
diff
changeset
|
58 |
'symbol': 'sy______', |
00671dc77c11
_fontdata.py: force all t1 defaults to be lowercase
rgbecker
parents:
2767
diff
changeset
|
59 |
'zapfdingbats': 'zd______', |
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
60 |
'helvetica': '_a______', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
61 |
'helvetica-bold': '_ab_____', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
62 |
'helvetica-boldoblique': '_abi____', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
63 |
'helvetica-oblique': '_ai_____', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
64 |
'times-bold': '_eb_____', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
65 |
'times-bolditalic': '_ebi____', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
66 |
'times-italic': '_ei_____', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
67 |
'times-roman': '_er_____', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
68 |
'courier-bold': 'cob_____', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
69 |
'courier-boldoblique': 'cobo____', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
70 |
'courier': 'com_____', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
71 |
'courier-oblique': 'coo_____', |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
72 |
} |
1981 | 73 |
if sys.platform in ('linux2',): |
74 |
_font2fnrMapLinux2 ={ |
|
75 |
'symbol': 'Symbol', |
|
76 |
'zapfdingbats': 'ZapfDingbats', |
|
77 |
'helvetica': 'Arial', |
|
78 |
'helvetica-bold': 'Arial-Bold', |
|
79 |
'helvetica-boldoblique': 'Arial-BoldItalic', |
|
80 |
'helvetica-oblique': 'Arial-Italic', |
|
81 |
'times-bold': 'TimesNewRoman-Bold', |
|
82 |
'times-bolditalic':'TimesNewRoman-BoldItalic', |
|
83 |
'times-italic': 'TimesNewRoman-Italic', |
|
84 |
'times-roman': 'TimesNewRoman', |
|
85 |
'courier-bold': 'Courier-Bold', |
|
86 |
'courier-boldoblique': 'Courier-BoldOblique', |
|
87 |
'courier': 'Courier', |
|
88 |
'courier-oblique': 'Courier-Oblique', |
|
89 |
} |
|
90 |
_font2fnrMap = _font2fnrMapLinux2 |
|
3723
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
91 |
for k, v in _font2fnrMap.items(): |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
92 |
if k in _font2fnrMapWin32.keys(): |
2767
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
93 |
_font2fnrMapWin32[v.lower()] = _font2fnrMapWin32[k] |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
94 |
del k, v |
1981 | 95 |
else: |
96 |
_font2fnrMap = _font2fnrMapWin32 |
|
881 | 97 |
|
98 |
def _findFNR(fontName): |
|
2767
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
99 |
return _font2fnrMap[fontName.lower()] |
881 | 100 |
|
2339
4b1dae4bd1a8
More changes related to compact distro path recognition
rgbecker
parents:
2332
diff
changeset
|
101 |
from reportlab.rl_config import T1SearchPath |
4b1dae4bd1a8
More changes related to compact distro path recognition
rgbecker
parents:
2332
diff
changeset
|
102 |
from reportlab.lib.utils import rl_isfile |
4b1dae4bd1a8
More changes related to compact distro path recognition
rgbecker
parents:
2332
diff
changeset
|
103 |
def _searchT1Dirs(n,rl_isfile=rl_isfile,T1SearchPath=T1SearchPath): |
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
104 |
assert T1SearchPath!=[], "No Type-1 font search path" |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
105 |
for d in T1SearchPath: |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
106 |
f = os.path.join(d,n) |
2339
4b1dae4bd1a8
More changes related to compact distro path recognition
rgbecker
parents:
2332
diff
changeset
|
107 |
if rl_isfile(f): return f |
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
108 |
return None |
2339
4b1dae4bd1a8
More changes related to compact distro path recognition
rgbecker
parents:
2332
diff
changeset
|
109 |
del T1SearchPath, rl_isfile |
881 | 110 |
|
1981 | 111 |
def findT1File(fontName,ext='.pfb'): |
112 |
if sys.platform in ('linux2',) and ext=='.pfb': |
|
113 |
try: |
|
114 |
f = _searchT1Dirs(_findFNR(fontName)) |
|
115 |
if f: return f |
|
116 |
except: |
|
117 |
pass |
|
2767
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
118 |
|
1981 | 119 |
try: |
2767
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
120 |
f = _searchT1Dirs(_font2fnrMapWin32[fontName.lower()]+ext) |
1981 | 121 |
if f: return f |
122 |
except: |
|
123 |
pass |
|
124 |
||
125 |
return _searchT1Dirs(_findFNR(fontName)+ext) |
|
126 |
||
687
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
127 |
# this lists the predefined font encodings - WinAnsi and MacRoman. We have |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
128 |
# not added MacExpert - it's possible, but would complicate life and nobody |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
129 |
# is asking. StandardEncoding means something special. |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
130 |
standardEncodings = ('WinAnsiEncoding','MacRomanEncoding','StandardEncoding','SymbolEncoding','ZapfDingbatsEncoding','PDFDocEncoding', 'MacExpertEncoding') |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
131 |
|
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
132 |
#this is the global mapping of standard encodings to name vectors |
3723
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
133 |
class _Name2StandardEncodingMap(dict): |
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
134 |
'''Trivial fake dictionary with some [] magic''' |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
135 |
_XMap = {'winansi':'WinAnsiEncoding','macroman': 'MacRomanEncoding','standard':'StandardEncoding','symbol':'SymbolEncoding', 'zapfdingbats':'ZapfDingbatsEncoding','pdfdoc':'PDFDocEncoding', 'macexpert':'MacExpertEncoding'} |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
136 |
def __setitem__(self,x,v): |
2767
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
137 |
y = x.lower() |
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
138 |
if y[-8:]=='encoding': y = y[:-8] |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
139 |
y = self._XMap[y] |
3723
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
140 |
if y in self: raise IndexError('Encoding %s is already set' % y) |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
141 |
dict.__setitem__(self,y,v) |
687
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
142 |
|
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
143 |
def __getitem__(self,x): |
2767
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
144 |
y = x.lower() |
1677
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
145 |
if y[-8:]=='encoding': y = y[:-8] |
1450177dd19e
Exterminated all tab characters and added a test to make sure
andy_robinson
parents:
966
diff
changeset
|
146 |
y = self._XMap[y] |
3723
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
147 |
return dict.__getitem__(self,y) |
687
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
148 |
|
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
149 |
encodings = _Name2StandardEncodingMap() |
3332 | 150 |
|
151 |
#due to compiled method size limits in Jython, |
|
152 |
#we pull these in from separate modules to keep this module |
|
153 |
#well under 64k. We might well be able to ditch many of |
|
154 |
#these anyway now we run on Unicode. |
|
687
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
155 |
|
3723
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
156 |
from reportlab.pdfbase._fontdata_enc_winansi import WinAnsiEncoding |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
157 |
from reportlab.pdfbase._fontdata_enc_macroman import MacRomanEncoding |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
158 |
from reportlab.pdfbase._fontdata_enc_standard import StandardEncoding |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
159 |
from reportlab.pdfbase._fontdata_enc_symbol import SymbolEncoding |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
160 |
from reportlab.pdfbase._fontdata_enc_zapfdingbats import ZapfDingbatsEncoding |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
161 |
from reportlab.pdfbase._fontdata_enc_pdfdoc import PDFDocEncoding |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
162 |
from reportlab.pdfbase._fontdata_enc_macexpert import MacExpertEncoding |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
163 |
encodings.update({ |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
164 |
'WinAnsiEncoding': WinAnsiEncoding, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
165 |
'MacRomanEncoding': MacRomanEncoding, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
166 |
'StandardEncoding': StandardEncoding, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
167 |
'SymbolEncoding': SymbolEncoding, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
168 |
'ZapfDingbatsEncoding': ZapfDingbatsEncoding, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
169 |
'PDFDocEncoding': PDFDocEncoding, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
170 |
'MacExpertEncoding': MacExpertEncoding, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
171 |
}) |
3332 | 172 |
|
687
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
173 |
ascent_descent = { |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
174 |
'Courier': (629, -157), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
175 |
'Courier-Bold': (626, -142), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
176 |
'Courier-BoldOblique': (626, -142), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
177 |
'Courier-Oblique': (629, -157), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
178 |
'Helvetica': (718, -207), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
179 |
'Helvetica-Bold': (718, -207), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
180 |
'Helvetica-BoldOblique': (718, -207), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
181 |
'Helvetica-Oblique': (718, -207), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
182 |
'Times-Roman': (683, -217), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
183 |
'Times-Bold': (676, -205), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
184 |
'Times-BoldItalic': (699, -205), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
185 |
'Times-Italic': (683, -205), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
186 |
'Symbol': (0, 0), |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
187 |
'ZapfDingbats': (0, 0) |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
188 |
} |
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
189 |
|
3332 | 190 |
# ditto about 64k limit - profusion of external files |
3723
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
191 |
import reportlab.pdfbase._fontdata_widths_courier |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
192 |
import reportlab.pdfbase._fontdata_widths_courierbold |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
193 |
import reportlab.pdfbase._fontdata_widths_courieroblique |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
194 |
import reportlab.pdfbase._fontdata_widths_courierboldoblique |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
195 |
import reportlab.pdfbase._fontdata_widths_helvetica |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
196 |
import reportlab.pdfbase._fontdata_widths_helveticabold |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
197 |
import reportlab.pdfbase._fontdata_widths_helveticaoblique |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
198 |
import reportlab.pdfbase._fontdata_widths_helveticaboldoblique |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
199 |
import reportlab.pdfbase._fontdata_widths_timesroman |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
200 |
import reportlab.pdfbase._fontdata_widths_timesbold |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
201 |
import reportlab.pdfbase._fontdata_widths_timesitalic |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
202 |
import reportlab.pdfbase._fontdata_widths_timesbolditalic |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
203 |
import reportlab.pdfbase._fontdata_widths_symbol |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
204 |
import reportlab.pdfbase._fontdata_widths_zapfdingbats |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
205 |
widthsByFontGlyph = { |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
206 |
'Courier': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
207 |
reportlab.pdfbase._fontdata_widths_courier.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
208 |
'Courier-Bold': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
209 |
reportlab.pdfbase._fontdata_widths_courierbold.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
210 |
'Courier-Oblique': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
211 |
reportlab.pdfbase._fontdata_widths_courieroblique.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
212 |
'Courier-BoldOblique': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
213 |
reportlab.pdfbase._fontdata_widths_courierboldoblique.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
214 |
'Helvetica': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
215 |
reportlab.pdfbase._fontdata_widths_helvetica.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
216 |
'Helvetica-Bold': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
217 |
reportlab.pdfbase._fontdata_widths_helveticabold.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
218 |
'Helvetica-Oblique': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
219 |
reportlab.pdfbase._fontdata_widths_helveticaoblique.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
220 |
'Helvetica-BoldOblique': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
221 |
reportlab.pdfbase._fontdata_widths_helveticaboldoblique.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
222 |
'Times-Roman': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
223 |
reportlab.pdfbase._fontdata_widths_timesroman.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
224 |
'Times-Bold': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
225 |
reportlab.pdfbase._fontdata_widths_timesbold.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
226 |
'Times-Italic': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
227 |
reportlab.pdfbase._fontdata_widths_timesitalic.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
228 |
'Times-BoldItalic': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
229 |
reportlab.pdfbase._fontdata_widths_timesbolditalic.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
230 |
'Symbol': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
231 |
reportlab.pdfbase._fontdata_widths_symbol.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
232 |
'ZapfDingbats': |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
233 |
reportlab.pdfbase._fontdata_widths_zapfdingbats.widths, |
99aa837b6703
second stage of port to Python 3.3; working hello world
rptlab
parents:
3721
diff
changeset
|
234 |
} |
687
b84a53895dcb
Initial split of pdfmetrics into code + database; some minor name adjustments
rgbecker
parents:
diff
changeset
|
235 |
|
2767
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
236 |
|
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
237 |
#preserve the initial values here |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
238 |
def _reset( |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
239 |
initial_dicts=dict( |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
240 |
ascent_descent=ascent_descent.copy(), |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
241 |
fontsByBaseEnc=fontsByBaseEnc.copy(), |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
242 |
fontsByName=fontsByName.copy(), |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
243 |
standardFontAttributes=standardFontAttributes.copy(), |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
244 |
widthVectorsByFont=widthVectorsByFont.copy(), |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
245 |
widthsByFontGlyph=widthsByFontGlyph.copy(), |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
246 |
) |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
247 |
): |
3721 | 248 |
for k,v in initial_dicts.items(): |
2767
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
249 |
d=globals()[k] |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
250 |
d.clear() |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
251 |
d.update(v) |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
252 |
|
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
253 |
from reportlab.rl_config import register_reset |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
254 |
register_reset(_reset) |
2ba5a1d26ad0
reportlab: make a85 wrap optional, add _reset to rl_config
rgbecker
parents:
2339
diff
changeset
|
255 |
del register_reset |