Initial commit: IT Site Survey AI v2 with all features
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
#Copyright ReportLab Europe Ltd. 2000-2017
|
||||
#see license.txt for license details
|
||||
#history https://hg.reportlab.com/hg-public/reportlab/log/tip/src/reportlab/pdfbase/__init__.py
|
||||
__version__='3.3.0'
|
||||
__doc__="""Internal functionality for creating PDF files - not part of API
|
||||
"""
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
#
|
||||
"""
|
||||
This is a utility to 'can' the widths data for certain CID fonts.
|
||||
Now we're using Unicode, we don't need 20 CMAP files for each Asian
|
||||
language, nor the widths of the non-normal characters encoded in each
|
||||
font. we just want a dictionary of the character widths in a given
|
||||
font which are NOT 1000 ems wide, keyed on Unicode character (not CID).
|
||||
|
||||
Running off CMAP files we get the following widths...::
|
||||
|
||||
>>> font = UnicodeCIDFont('HeiseiMin-W3')
|
||||
>>> font.stringWidth(unicode(','), 10)
|
||||
2.5
|
||||
>>> font.stringWidth(unicode('m'), 10)
|
||||
7.7800000000000002
|
||||
>>> font.stringWidth(u'\u6771\u4EAC', 10)
|
||||
20.0
|
||||
>>>
|
||||
|
||||
"""
|
||||
|
||||
from reportlab.pdfbase._cidfontdata import defaultUnicodeEncodings
|
||||
from reportlab.pdfbase.cidfonts import UnicodeCIDFont
|
||||
|
||||
|
||||
def run():
|
||||
|
||||
buf = []
|
||||
buf.append('widthsByUnichar = {}')
|
||||
for fontName, (language, encName) in defaultUnicodeEncodings.items():
|
||||
print('handling %s : %s : %s' % (fontName, language, encName))
|
||||
|
||||
#this does just about all of it for us, as all the info
|
||||
#we need is present.
|
||||
font = UnicodeCIDFont(fontName)
|
||||
|
||||
widthsByCID = font.face._explicitWidths
|
||||
cmap = font.encoding._cmap
|
||||
nonStandardWidthsByUnichar = {}
|
||||
for codePoint, cid in cmap.items():
|
||||
width = widthsByCID.get(cid, 1000)
|
||||
if width != 1000:
|
||||
nonStandardWidthsByUnichar[chr(codePoint)] = width
|
||||
|
||||
|
||||
|
||||
print('created font width map (%d items). ' % len(nonStandardWidthsByUnichar))
|
||||
|
||||
buf.append('widthsByUnichar["%s"] = %s' % (fontName, repr(nonStandardWidthsByUnichar)))
|
||||
|
||||
|
||||
src = '\n'.join(buf) + '\n'
|
||||
open('canned_widths.py','w').write(src)
|
||||
print('wrote canned_widths.py')
|
||||
|
||||
if __name__=='__main__':
|
||||
run()
|
||||
|
||||
@@ -0,0 +1,483 @@
|
||||
#Copyright ReportLab Europe Ltd. 2000-2017
|
||||
#see license.txt for license details
|
||||
#history https://hg.reportlab.com/hg-public/reportlab/log/tip/src/reportlab/pdfbase/_cidfontdata.py
|
||||
#$Header $
|
||||
__version__='3.3.0'
|
||||
__doc__="""
|
||||
This defines additional static data to support CID fonts.
|
||||
|
||||
Canned data is provided for the Japanese fonts supported by Adobe. We
|
||||
can add Chinese, Korean and Vietnamese in due course. The data was
|
||||
extracted by creating very simple postscript documents and running
|
||||
through Distiller, then examining the resulting PDFs.
|
||||
|
||||
Each font is described as a big nested dictionary. This lets us keep
|
||||
code out of the module altogether and avoid circular dependencies.
|
||||
|
||||
The encoding and font data are grouped by some standard 'language
|
||||
prefixes'::
|
||||
|
||||
chs = Chinese Simplified (mainland)
|
||||
cht = Chinese Traditional (Taiwan)
|
||||
kor = Korean
|
||||
jpn = Japanese
|
||||
"""
|
||||
|
||||
|
||||
languages = ['jpn', 'kor', 'cht', 'chs']
|
||||
|
||||
#breaking down the lists let us check if something is present
|
||||
#for a specific language
|
||||
typeFaces_chs = ['STSong-Light'] # to do
|
||||
typeFaces_cht = ['MSung-Light'] #, 'MHei-Medium'] # to do
|
||||
typeFaces_jpn = ['HeiseiMin-W3', 'HeiseiKakuGo-W5']
|
||||
typeFaces_kor = ['HYSMyeongJo-Medium','HYGothic-Medium']
|
||||
|
||||
allowedTypeFaces = typeFaces_chs + typeFaces_cht + typeFaces_jpn + typeFaces_kor
|
||||
|
||||
|
||||
|
||||
|
||||
encodings_jpn = [
|
||||
# official encoding names, comments taken verbatim from PDF Spec
|
||||
'83pv-RKSJ-H', #Macintosh, JIS X 0208 character set with KanjiTalk6
|
||||
#extensions, Shift-JIS encoding, Script Manager code 1
|
||||
'90ms-RKSJ-H', #Microsoft Code Page 932 (lfCharSet 0x80), JIS X 0208
|
||||
#character set with NEC and IBM extensions
|
||||
'90ms-RKSJ-V', #Vertical version of 90ms-RKSJ-H
|
||||
'90msp-RKSJ-H', #Same as 90ms-RKSJ-H, but replaces half-width Latin
|
||||
#characters with proportional forms
|
||||
'90msp-RKSJ-V', #Vertical version of 90msp-RKSJ-H
|
||||
'90pv-RKSJ-H', #Macintosh, JIS X 0208 character set with KanjiTalk7
|
||||
#extensions, Shift-JIS encoding, Script Manager code 1
|
||||
'Add-RKSJ-H', #JIS X 0208 character set with Fujitsu FMR extensions,
|
||||
#Shift-JIS encoding
|
||||
'Add-RKSJ-V', #Vertical version of Add-RKSJ-H
|
||||
'EUC-H', #JIS X 0208 character set, EUC-JP encoding
|
||||
'EUC-V', #Vertical version of EUC-H
|
||||
'Ext-RKSJ-H', #JIS C 6226 (JIS78) character set with NEC extensions,
|
||||
#Shift-JIS encoding
|
||||
'Ext-RKSJ-V', #Vertical version of Ext-RKSJ-H
|
||||
'H', #JIS X 0208 character set, ISO-2022-JP encoding,
|
||||
'V', #Vertical version of H
|
||||
'UniJIS-UCS2-H', #Unicode (UCS-2) encoding for the Adobe-Japan1 character
|
||||
#collection
|
||||
'UniJIS-UCS2-V', #Vertical version of UniJIS-UCS2-H
|
||||
'UniJIS-UCS2-HW-H', #Same as UniJIS-UCS2-H, but replaces proportional Latin
|
||||
#characters with half-width forms
|
||||
'UniJIS-UCS2-HW-V' #Vertical version of UniJIS-UCS2-HW-H
|
||||
]
|
||||
encodings_kor = [
|
||||
'KSC-EUC-H', # KS X 1001:1992 character set, EUC-KR encoding
|
||||
'KSC-EUC-V', # Vertical version of KSC-EUC-H
|
||||
'KSCms-UHC-H', # Microsoft Code Page 949 (lfCharSet 0x81), KS X 1001:1992
|
||||
#character set plus 8,822 additional hangul, Unified Hangul
|
||||
#Code (UHC) encoding
|
||||
'KSCms-UHC-V', #Vertical version of KSCms-UHC-H
|
||||
'KSCms-UHC-HW-H', #Same as KSCms-UHC-H, but replaces proportional Latin
|
||||
# characters with halfwidth forms
|
||||
'KSCms-UHC-HW-V', #Vertical version of KSCms-UHC-HW-H
|
||||
'KSCpc-EUC-H', #Macintosh, KS X 1001:1992 character set with MacOS-KH
|
||||
#extensions, Script Manager Code 3
|
||||
'UniKS-UCS2-H', #Unicode (UCS-2) encoding for the Adobe-Korea1 character collection
|
||||
'UniKS-UCS2-V' #Vertical version of UniKS-UCS2-H
|
||||
|
||||
]
|
||||
|
||||
encodings_chs = [
|
||||
|
||||
'GB-EUC-H', # Microsoft Code Page 936 (lfCharSet 0x86), GB 2312-80
|
||||
# character set, EUC-CN encoding
|
||||
'GB-EUC-V', # Vertical version of GB-EUC-H
|
||||
'GBpc-EUC-H', # Macintosh, GB 2312-80 character set, EUC-CN encoding,
|
||||
# Script Manager code 2
|
||||
'GBpc-EUC-V', # Vertical version of GBpc-EUC-H
|
||||
'GBK-EUC-H', # Microsoft Code Page 936 (lfCharSet 0x86), GBK character
|
||||
# set, GBK encoding
|
||||
'GBK-EUC-V', # Vertical version of GBK-EUC-V
|
||||
'UniGB-UCS2-H', # Unicode (UCS-2) encoding for the Adobe-GB1
|
||||
# character collection
|
||||
'UniGB-UCS2-V' # Vertical version of UniGB-UCS2-H.
|
||||
]
|
||||
|
||||
encodings_cht = [
|
||||
'B5pc-H', # Macintosh, Big Five character set, Big Five encoding,
|
||||
# Script Manager code 2
|
||||
'B5pc-V', # Vertical version of B5pc-H
|
||||
'ETen-B5-H', # Microsoft Code Page 950 (lfCharSet 0x88), Big Five
|
||||
# character set with ETen extensions
|
||||
'ETen-B5-V', # Vertical version of ETen-B5-H
|
||||
'ETenms-B5-H', # Microsoft Code Page 950 (lfCharSet 0x88), Big Five
|
||||
# character set with ETen extensions; this uses proportional
|
||||
# forms for half-width Latin characters.
|
||||
'ETenms-B5-V', # Vertical version of ETenms-B5-H
|
||||
'CNS-EUC-H', # CNS 11643-1992 character set, EUC-TW encoding
|
||||
'CNS-EUC-V', # Vertical version of CNS-EUC-H
|
||||
'UniCNS-UCS2-H', # Unicode (UCS-2) encoding for the Adobe-CNS1
|
||||
# character collection
|
||||
'UniCNS-UCS2-V' # Vertical version of UniCNS-UCS2-H.
|
||||
]
|
||||
|
||||
# the Identity encodings simply dump out all character
|
||||
# in the font in the order they were defined.
|
||||
allowedEncodings = (['Identity-H', 'Identity-V'] +
|
||||
encodings_chs +
|
||||
encodings_cht +
|
||||
encodings_jpn +
|
||||
encodings_kor
|
||||
)
|
||||
|
||||
defaultUnicodeEncodings = {
|
||||
#we ddefine a default Unicode encoding for each face name;
|
||||
#this should be the most commonly used horizontal unicode encoding;
|
||||
#also define a 3-letter language code.
|
||||
'HeiseiMin-W3': ('jpn','UniJIS-UCS2-H'),
|
||||
'HeiseiKakuGo-W5': ('jpn','UniJIS-UCS2-H'),
|
||||
'STSong-Light': ('chs', 'UniGB-UCS2-H'),
|
||||
'MSung-Light': ('cht', 'UniGB-UCS2-H'),
|
||||
#'MHei-Medium': ('cht', 'UniGB-UCS2-H'),
|
||||
'HYSMyeongJo-Medium': ('kor', 'UniKS-UCS2-H'),
|
||||
'HYGothic-Medium': ('kor','UniKS-UCS2-H'),
|
||||
}
|
||||
|
||||
typeFaces_chs = ['STSong-Light'] # to do
|
||||
typeFaces_cht = ['MSung-Light', 'MHei-Medium'] # to do
|
||||
typeFaces_jpn = ['HeiseiMin-W3', 'HeiseiKakuGo-W5']
|
||||
typeFaces_kor = ['HYSMyeongJo-Medium','HYGothic-Medium']
|
||||
|
||||
|
||||
#declare separately those used for unicode
|
||||
unicode_encodings = [enc for enc in allowedEncodings if 'UCS2' in enc]
|
||||
|
||||
|
||||
CIDFontInfo = {}
|
||||
#statically describe the fonts in Adobe's Japanese Language Packs
|
||||
CIDFontInfo['HeiseiMin-W3'] = {
|
||||
'Type':'/Font',
|
||||
'Subtype':'/Type0',
|
||||
'Name': '/%(internalName)s' , #<-- the internal name
|
||||
'BaseFont': '/HeiseiMin-W3',
|
||||
'Encoding': '/%(encodings)s',
|
||||
|
||||
#there could be several descendant fonts if it is an old-style
|
||||
#type 0 compound font. For CID fonts there is just one.
|
||||
'DescendantFonts': [{
|
||||
'Type':'/Font',
|
||||
'Subtype':'/CIDFontType0',
|
||||
'BaseFont':'/HeiseiMin-W3',
|
||||
'FontDescriptor': {
|
||||
'Type': '/FontDescriptor',
|
||||
'Ascent': 723,
|
||||
'CapHeight': 709,
|
||||
'Descent': -241,
|
||||
'Flags': 6,
|
||||
'FontBBox': (-123, -257, 1001, 910),
|
||||
'FontName': '/HeiseiMin-W3',
|
||||
'ItalicAngle': 0,
|
||||
'StemV': 69,
|
||||
'XHeight': 450#,
|
||||
# 'Style': {'Panose': '<010502020400000000000000>'}
|
||||
},
|
||||
'CIDSystemInfo': {
|
||||
'Registry': '(Adobe)',
|
||||
'Ordering': '(Japan1)',
|
||||
'Supplement': 2
|
||||
},
|
||||
#default width is 1000 em units
|
||||
'DW': 1000,
|
||||
#widths of any which are not the default.
|
||||
'W': [1, [250, 333, 408, 500],
|
||||
5, [500, 833, 778, 180, 333],
|
||||
10, [333, 500, 564, 250, 333, 250, 278, 500],
|
||||
18, 26, 500, 27, 28, 278, 29, 31, 564,
|
||||
32, [444, 921, 722, 667],
|
||||
36, [667, 722, 611, 556, 722],
|
||||
41, [722, 333, 389, 722, 611, 889, 722],
|
||||
48, [722, 556, 722, 667, 556, 611, 722],
|
||||
55, [722, 944, 722],
|
||||
58, [722, 611, 333, 500, 333, 469, 500, 333,
|
||||
444, 500, 444, 500, 444, 333, 500],
|
||||
73, [500, 278],
|
||||
75, [278, 500, 278, 778, 500], 80, 82, 500,
|
||||
83, [333, 389, 278, 500],
|
||||
87, [500, 722, 500],
|
||||
90, [500, 444, 480, 200, 480, 333],
|
||||
97, [278], 99, [200], 101, [333, 500], 103, [500, 167],
|
||||
107, [500], 109, [500, 333], 111, [333, 556],
|
||||
113, [556, 500], 117, [250], 119, [350, 333, 444],
|
||||
123, [500], 126, [444, 333], 128, 137, 333,
|
||||
138, [1000, 889, 276, 611, 722, 889, 310, 667, 278],
|
||||
147, [278, 500, 722, 500, 564, 760, 564, 760],
|
||||
157, 158, 300, 159, [500, 300, 750], 162, 163, 750,
|
||||
164, 169, 722, 170, [667, 611], 172, 174, 611, 175,
|
||||
178, 333, 179, 185, 722, 187, 191, 722, 192,
|
||||
[556, 444], 194, 203, 444, 204, 207, 278, 208,
|
||||
214, 500, 216, 222, 500,
|
||||
223, [556, 722, 611, 500, 389, 980, 444],
|
||||
231, [500], 323, [500], 325, [500],
|
||||
327, 389, 500]
|
||||
## 'W': (
|
||||
## # starting at character ID 1, next n characters have the widths given.
|
||||
## 1, (277,305,500,668,668,906,727,305,445,445,508,668,305,379,305,539),
|
||||
## # all Characters from ID 17 to 26 are 668 em units wide
|
||||
## 17, 26, 668,
|
||||
## 27, (305, 305, 668, 668, 668, 566, 871, 727, 637, 652, 699, 574, 555,
|
||||
## 676, 687, 242, 492, 664, 582, 789, 707, 734, 582, 734, 605, 605,
|
||||
## 641, 668, 727, 945, 609, 609, 574, 445, 668, 445, 668, 668, 590,
|
||||
## 555, 609, 547, 602, 574, 391, 609, 582, 234, 277, 539, 234, 895,
|
||||
## 582, 605, 602, 602, 387, 508, 441, 582, 562, 781, 531, 570, 555,
|
||||
## 449, 246, 449, 668),
|
||||
## # these must be half width katakana and the like.
|
||||
## 231, 632, 500
|
||||
## )
|
||||
}]# end list of descendant fonts
|
||||
} #end HeiseiMin-W3
|
||||
|
||||
CIDFontInfo['HeiseiKakuGo-W5'] = {'Type':'/Font',
|
||||
'Subtype':'/Type0',
|
||||
'Name': '/%(internalName)s', #<-- the internal name
|
||||
'BaseFont': '/HeiseiKakuGo-W5',
|
||||
'Encoding': '/%(encodings)s',
|
||||
'DescendantFonts': [{'Type':'/Font',
|
||||
'Subtype':'/CIDFontType0',
|
||||
'BaseFont':'/HeiseiKakuGo-W5',
|
||||
'FontDescriptor': {
|
||||
'Type': '/FontDescriptor',
|
||||
'Ascent': 752,
|
||||
'CapHeight': 737,
|
||||
'Descent': -221,
|
||||
'Flags': 4,
|
||||
'FontBBox': [-92, -250, 1010, 922],
|
||||
'FontName': '/HeiseKakuGo-W5',
|
||||
'ItalicAngle': 0,
|
||||
'StemH': 0,
|
||||
'StemV': 114,
|
||||
'XHeight': 553,
|
||||
## 'Style': {'Panose': '<0801020b0600000000000000>'}
|
||||
},
|
||||
'CIDSystemInfo': {
|
||||
'Registry': '(Adobe)',
|
||||
'Ordering': '(Japan1)',
|
||||
'Supplement': 2
|
||||
},
|
||||
'DW': 1000,
|
||||
'W': (
|
||||
1, (277,305,500,668,668,906,727,305,445,445,508,668,305,379,305,539),
|
||||
17, 26, 668,
|
||||
27, (305, 305, 668, 668, 668, 566, 871, 727, 637, 652, 699, 574, 555,
|
||||
676, 687, 242, 492, 664, 582, 789, 707, 734, 582, 734, 605, 605,
|
||||
641, 668, 727, 945, 609, 609, 574, 445, 668, 445, 668, 668, 590,
|
||||
555, 609, 547, 602, 574, 391, 609, 582, 234, 277, 539, 234, 895,
|
||||
582, 605, 602, 602, 387, 508, 441, 582, 562, 781, 531, 570, 555,
|
||||
449, 246, 449, 668),
|
||||
231, 632, 500
|
||||
)
|
||||
}] # end descendant fonts
|
||||
}
|
||||
|
||||
CIDFontInfo['HYGothic-Medium'] = {'Type':'/Font',
|
||||
'Subtype':'/Type0',
|
||||
'Name': '/%(internalName)s', #<-- the internal name
|
||||
'BaseFont': '/' + 'HYGothic-Medium',
|
||||
'Encoding': '/%(encodings)s',
|
||||
'DescendantFonts': [{'Type':'/Font',
|
||||
'Subtype':'/CIDFontType0',
|
||||
'BaseFont':'/'+'HYGothic-Medium',
|
||||
'FontDescriptor': {
|
||||
'Type': '/FontDescriptor',
|
||||
'Ascent': 752,
|
||||
'AvgWidth': -271,
|
||||
'CapHeight': 737,
|
||||
'Descent': -142,
|
||||
'Flags': 6,
|
||||
'FontBBox': [-6, -145, 1003, 880],
|
||||
'FontName': '/'+'HYSMyeongJo-Medium',
|
||||
'ItalicAngle': 0,
|
||||
'Leading': 148,
|
||||
'MaxWidth': 1000,
|
||||
'MissingWidth': 500,
|
||||
'StemH': 0,
|
||||
'StemV': 58,
|
||||
'XHeight': 553
|
||||
},
|
||||
'CIDSystemInfo': {
|
||||
'Registry': '(Adobe)',
|
||||
'Ordering': '(Korea1)',
|
||||
'Supplement': 1
|
||||
},
|
||||
'DW': 1000,
|
||||
'W': (1, 94, 500)
|
||||
}] # end descendant fonts
|
||||
}
|
||||
|
||||
CIDFontInfo['HYSMyeongJo-Medium'] = {'Type':'/Font',
|
||||
'Subtype':'/Type0',
|
||||
'Name': '/%(internalName)s', #<-- the internal name
|
||||
'BaseFont': '/' + 'HYSMyeongJo-Medium',
|
||||
'Encoding': '/%(encodings)s',
|
||||
'DescendantFonts': [{'Type':'/Font',
|
||||
'Subtype':'/CIDFontType2',
|
||||
'BaseFont':'/'+'HYSMyeongJo-Medium',
|
||||
'FontDescriptor': {
|
||||
'Type': '/FontDescriptor',
|
||||
'Ascent': 752,
|
||||
'AvgWidth': 500,
|
||||
'CapHeight': 737,
|
||||
'Descent': -271,
|
||||
'Flags': 6,
|
||||
'FontBBox': [0, -148, 1001, 880],
|
||||
'FontName': '/'+'HYSMyeongJo-Medium',
|
||||
'ItalicAngle': 0,
|
||||
'Leading': 148,
|
||||
'MaxWidth': 1000,
|
||||
'MissingWidth': 500,
|
||||
'StemH': 91,
|
||||
'StemV': 58,
|
||||
'XHeight': 553
|
||||
},
|
||||
'CIDSystemInfo': {
|
||||
'Registry': '(Adobe)',
|
||||
'Ordering': '(Korea1)',
|
||||
'Supplement': 1
|
||||
},
|
||||
'DW': 1000,
|
||||
'W': [1, [333, 416],
|
||||
3, [416, 833, 625, 916, 833, 250, 500],
|
||||
10, 11, 500,
|
||||
12, [833, 291, 833, 291, 375, 625],
|
||||
18, 26, 625, 27, 28, 333, 29, 30, 833,
|
||||
31, [916, 500, 1000, 791, 708],
|
||||
36, [708, 750, 708, 666, 750, 791, 375,
|
||||
500, 791, 666, 916, 791, 750, 666,
|
||||
750, 708, 666, 791],
|
||||
54, [791, 750, 1000, 708],
|
||||
58, [708, 666, 500, 375, 500],
|
||||
63, 64, 500,
|
||||
65, [333, 541, 583, 541, 583],
|
||||
70, [583, 375, 583],
|
||||
73, [583, 291, 333, 583, 291, 875, 583],
|
||||
80, 82, 583,
|
||||
83, [458, 541, 375, 583],
|
||||
87, [583, 833, 625],
|
||||
90, [625, 500, 583], 93, 94, 583,
|
||||
95, [750]
|
||||
]
|
||||
}] # end descendant fonts
|
||||
}
|
||||
|
||||
#WARNING - not checked, just copied Korean to get some output
|
||||
|
||||
CIDFontInfo['STSong-Light'] = {'Type':'/Font',
|
||||
'Subtype':'/Type0',
|
||||
'Name': '/%(internalName)s', #<-- the internal name
|
||||
'BaseFont': '/' + 'STSong-Light',
|
||||
'Encoding': '/%(encodings)s',
|
||||
'DescendantFonts': [{'Type':'/Font',
|
||||
'Subtype':'/CIDFontType0',
|
||||
'BaseFont':'/'+'STSong-Light',
|
||||
'FontDescriptor': {
|
||||
'Type': '/FontDescriptor',
|
||||
'Ascent': 752,
|
||||
'CapHeight': 737,
|
||||
'Descent': -271,
|
||||
'Flags': 6,
|
||||
'FontBBox': [-25, -254, 1000, 880],
|
||||
'FontName': '/'+'STSongStd-Light',
|
||||
'ItalicAngle': 0,
|
||||
'Leading': 148,
|
||||
'MaxWidth': 1000,
|
||||
'MissingWidth': 500,
|
||||
'StemH': 91,
|
||||
'StemV': 58,
|
||||
'XHeight': 553
|
||||
},
|
||||
'CIDSystemInfo': {
|
||||
'Registry': '(Adobe)',
|
||||
'Ordering': '(GB1)',
|
||||
'Supplement': 0
|
||||
},
|
||||
'DW': 1000,
|
||||
'W': [1, [207, 270, 342, 467, 462, 797, 710, 239, 374],
|
||||
10, [374, 423, 605, 238, 375, 238, 334, 462],
|
||||
18, 26, 462, 27, 28, 238, 29, 31, 605,
|
||||
32, [344, 748, 684, 560, 695, 739, 563, 511, 729,
|
||||
793, 318, 312, 666, 526, 896, 758, 772, 544,
|
||||
772, 628, 465, 607, 753, 711, 972, 647, 620,
|
||||
607, 374, 333, 374, 606, 500, 239, 417, 503,
|
||||
427, 529, 415, 264, 444, 518, 241, 230, 495,
|
||||
228, 793, 527, 524],
|
||||
81, [524, 504, 338, 336, 277, 517, 450, 652, 466,
|
||||
452, 407, 370, 258, 370, 605]
|
||||
]
|
||||
}] # end descendant fonts
|
||||
}
|
||||
CIDFontInfo['MSung-Light'] = {'Type':'/Font',
|
||||
'Subtype':'/Type0',
|
||||
'Name': '/%(internalName)s', #<-- the internal name
|
||||
'BaseFont': '/' + 'MSung-Light',
|
||||
'Encoding': '/%(encodings)s',
|
||||
'DescendantFonts': [{'Type':'/Font',
|
||||
'Subtype':'/CIDFontType0',
|
||||
'BaseFont':'/'+'MSung-Light',
|
||||
'FontDescriptor': {
|
||||
'Type': '/FontDescriptor',
|
||||
'Ascent': 752,
|
||||
'CapHeight': 737,
|
||||
'Descent': -271,
|
||||
'Flags': 6,
|
||||
'FontBBox': [-160, -249, 1015, 888],
|
||||
'FontName': '/'+'MSung-Light',
|
||||
'ItalicAngle': 0,
|
||||
'Leading': 148,
|
||||
'MaxWidth': 1000,
|
||||
'MissingWidth': 500,
|
||||
'StemH': 45,
|
||||
'StemV': 58,
|
||||
'XHeight': 553
|
||||
},
|
||||
'CIDSystemInfo': {
|
||||
'Registry': '(Adobe)',
|
||||
'Ordering': '(CNS1)',
|
||||
'Supplement': 1
|
||||
},
|
||||
'DW': 1000,
|
||||
'W': [1, 2, 250, 3, [408, 668, 490, 875, 698, 250, 240],
|
||||
10, [240, 417, 667, 250, 313, 250, 520, 500],
|
||||
18, 26, 500, 27, 28, 250, 29, 31, 667,
|
||||
32, [396, 921, 677, 615, 719, 760, 625, 552, 771,
|
||||
802, 354],
|
||||
43, [354, 781, 604, 927, 750, 823, 563, 823, 729,
|
||||
542, 698, 771, 729, 948, 771, 677, 635, 344,
|
||||
520, 344, 469, 500, 250, 469, 521, 427, 521,
|
||||
438, 271, 469, 531, 250],
|
||||
75, [250, 458, 240, 802, 531, 500, 521],
|
||||
82, [521, 365, 333, 292, 521, 458, 677, 479, 458,
|
||||
427, 480, 496, 480, 667]]
|
||||
|
||||
}] # end descendant fonts
|
||||
}
|
||||
|
||||
|
||||
#this data was derived from the above width information and removes all dependency on CMAP files as long as we only use the unicode fonts.
|
||||
widthsByUnichar = {}
|
||||
widthsByUnichar["MSung-Light"] = {u' ': 250, u'$': 490, u'(': 240, u',': 250, u'0': 500, u'4': 500, u'8': 500, u'<': 667, u'@': 921, u'D': 760, u'H': 802, u'L': 604, u'P': 563, u'T': 698, u'X': 771, u'\\': 520, u'`': 250, u'd': 521, u'h': 531, u'l': 240, u'p': 521, u't': 292, u'x': 479, u'|': 496, u'#': 668, u"'": 250, u'+': 667, u'/': 520, u'3': 500, u'7': 500, u';': 250, u'?': 396, u'C': 719, u'G': 771, u'K': 781, u'O': 823, u'S': 542, u'W': 948, u'[': 344, u'_': 500, u'c': 427, u'g': 469, u'k': 458, u'o': 500, u's': 333, u'w': 677, u'{': 480, u'"': 408, u'&': 698, u'*': 417, u'.': 250, u'2': 500, u'6': 500, u':': 250, u'>': 667, u'B': 615, u'F': 552, u'J': 354, u'N': 750, u'R': 729, u'V': 729, u'Z': 635, u'^': 469, u'b': 521, u'f': 271, u'j': 250, u'n': 531, u'r': 365, u'v': 458, u'z': 427, u'~': 667, u'!': 250, u'%': 875, u')': 240, u'-': 313, u'1': 500, u'5': 500, u'9': 500, u'=': 667, u'A': 677, u'E': 625, u'I': 354, u'M': 927, u'Q': 823, u'U': 771, u'Y': 677, u']': 344, u'a': 469, u'e': 438, u'i': 250, u'm': 802, u'q': 521, u'u': 521, u'y': 458, u'}': 480}
|
||||
widthsByUnichar["HeiseiKakuGo-W5"] = {u'\uff81': 500, u'\uff85': 500, u'\uff89': 500, u'\uff8d': 500, u'\uff91': 500, u'\uff95': 500, u'\uff99': 500, u'\uff9d': 500, u' ': 277, u'$': 668, u'(': 445, u',': 305, u'0': 668, u'\u0332': 668, u'4': 668, u'8': 668, u'<': 668, u'@': 871, u'D': 699, u'H': 687, u'L': 582, u'P': 582, u'T': 641, u'X': 609, u'`': 590, u'\uff62': 500, u'd': 602, u'\uff66': 500, u'h': 582, u'\uff6a': 500, u'l': 234, u'\uff6e': 500, u'p': 602, u'\uff72': 500, u't': 441, u'\uff76': 500, u'x': 531, u'\uff7a': 500, u'|': 246, u'\uff7e': 500, u'\uff82': 500, u'\uff86': 500, u'\uff8a': 500, u'\uff8e': 500, u'\uff92': 500, u'\uff96': 500, u'\uff9a': 500, u'\uff9e': 500, u'#': 668, u"'": 305, u'+': 668, u'/': 539, u'3': 668, u'7': 668, u';': 305, u'?': 566, u'C': 652, u'G': 676, u'K': 664, u'O': 734, u'S': 605, u'W': 945, u'[': 445, u'_': 668, u'\uff61': 500, u'c': 547, u'\uff65': 500, u'g': 609, u'\uff69': 500, u'k': 539, u'\uff6d': 500, u'o': 605, u'\uff71': 500, u's': 508, u'\uff75': 500, u'w': 781, u'\uff79': 500, u'{': 449, u'\uff7d': 500, u'\u0300': 590, u'\uff83': 500, u'\u2002': 500, u'\uff87': 500, u'\uff8b': 500, u'\uff8f': 500, u'\uff93': 500, u'\uff97': 500, u'\uff9b': 500, u'\uff9f': 500, u'"': 500, u'\xa5': 668, u'&': 727, u'*': 508, u'.': 305, u'2': 668, u'6': 668, u':': 305, u'>': 668, u'B': 637, u'F': 555, u'J': 492, u'N': 707, u'\u203e': 500, u'R': 605, u'V': 727, u'Z': 574, u'^': 668, u'b': 609, u'\uff64': 500, u'f': 391, u'\uff68': 500, u'j': 277, u'\uff6c': 500, u'n': 582, u'\uff70': 500, u'r': 387, u'\uff74': 500, u'v': 562, u'\uff78': 500, u'z': 555, u'\uff7c': 500, u'~': 668, u'\uff80': 500, u'\u0303': 668, u'\uff84': 500, u'\uff88': 500, u'\uff8c': 500, u'\u2011': 379, u'\uff90': 500, u'\uff94': 500, u'\uff98': 500, u'\uff9c': 500, u'!': 305, u'%': 906, u')': 445, u'-': 379, u'1': 668, u'5': 668, u'9': 668, u'=': 668, u'A': 727, u'E': 574, u'I': 242, u'M': 789, u'Q': 734, u'U': 668, u'Y': 609, u']': 445, u'a': 555, u'\uff63': 500, u'e': 574, u'\uff67': 500, u'i': 234, u'\uffe8': 500, u'\uff6b': 500, u'm': 895, u'\uff6f': 500, u'q': 602, u'\uff73': 500, u'u': 582, u'\uff77': 500, u'y': 570, u'\uff7b': 500, u'}': 449, u'\uff7f': 500}
|
||||
widthsByUnichar["HYSMyeongJo-Medium"] = {u' ': 333, u'$': 625, u'(': 500, u',': 291, u'0': 625, u'4': 625, u'8': 625, u'<': 833, u'D': 750, u'H': 791, u'L': 666, u'P': 666, u'T': 791, u'X': 708, u'\\': 375, u'`': 333, u'd': 583, u'h': 583, u'l': 291, u'p': 583, u't': 375, u'x': 625, u'|': 583, u'#': 833, u"'": 250, u'+': 833, u'/': 375, u'3': 625, u'7': 625, u';': 333, u'?': 500, u'C': 708, u'G': 750, u'K': 791, u'O': 750, u'S': 666, u'[': 500, u'_': 500, u'c': 541, u'g': 583, u'k': 583, u'o': 583, u's': 541, u'w': 833, u'{': 583, u'"': 416, u'&': 833, u'*': 500, u'.': 291, u'2': 625, u'6': 625, u':': 333, u'>': 916, u'B': 708, u'F': 666, u'J': 500, u'N': 791, u'R': 708, u'V': 750, u'Z': 666, u'^': 500, u'b': 583, u'f': 375, u'j': 333, u'n': 583, u'r': 458, u'v': 583, u'z': 500, u'~': 750, u'!': 416, u'%': 916, u')': 500, u'-': 833, u'1': 625, u'5': 625, u'9': 625, u'=': 833, u'A': 791, u'E': 708, u'I': 375, u'M': 916, u'Q': 750, u'U': 791, u'Y': 708, u']': 500, u'a': 541, u'e': 583, u'i': 291, u'm': 875, u'q': 583, u'u': 583, u'y': 625, u'}': 583}
|
||||
widthsByUnichar["STSong-Light"] = {u' ': 207, u'$': 462, u'(': 374, u',': 238, u'0': 462, u'4': 462, u'8': 462, u'<': 605, u'@': 748, u'D': 739, u'H': 793, u'L': 526, u'P': 544, u'T': 607, u'X': 647, u'\\': 333, u'`': 239, u'd': 529, u'h': 518, u'l': 228, u'p': 524, u't': 277, u'x': 466, u'|': 258, u'#': 467, u"'": 239, u'+': 605, u'/': 334, u'3': 462, u'7': 462, u';': 238, u'?': 344, u'C': 695, u'G': 729, u'K': 666, u'O': 772, u'S': 465, u'W': 972, u'[': 374, u'_': 500, u'c': 427, u'g': 444, u'k': 495, u'o': 524, u's': 336, u'w': 652, u'{': 370, u'"': 342, u'&': 710, u'*': 423, u'.': 238, u'2': 462, u'6': 462, u':': 238, u'>': 605, u'B': 560, u'F': 511, u'J': 312, u'N': 758, u'R': 628, u'V': 711, u'Z': 607, u'^': 606, u'b': 503, u'f': 264, u'j': 230, u'n': 527, u'r': 338, u'v': 450, u'z': 407, u'~': 605, u'!': 270, u'%': 797, u')': 374, u'-': 375, u'1': 462, u'5': 462, u'9': 462, u'=': 605, u'A': 684, u'E': 563, u'I': 318, u'M': 896, u'Q': 772, u'U': 753, u'Y': 620, u']': 374, u'a': 417, u'e': 415, u'i': 241, u'm': 793, u'q': 504, u'u': 517, u'y': 452, u'}': 370}
|
||||
widthsByUnichar["HeiseiMin-W3"] = {u'\uff81': 500, u'\u0302': 333, u'\uff85': 500, u'\u0306': 333, u'\uff89': 500, u'\u030a': 333, u'\uff8d': 500, u'\uff91': 500, u'\ufb02': 556, u'\uff95': 500, u'\uff99': 500, u'\uff9d': 500, u' ': 250, u'\xa3': 500, u'\u2122': 980, u'$': 500, u'(': 333, u'\xab': 500, u',': 250, u'\xaf': 333, u'0': 500, u'\xb3': 300, u'\u0332': 500, u'4': 500, u'\xb7': 250, u'8': 500, u'\xbb': 500, u'<': 564, u'\xbf': 444, u'@': 921, u'\xc3': 722, u'\u0142': 278, u'D': 722, u'\xc7': 667, u'H': 722, u'\xcb': 611, u'L': 611, u'\xcf': 333, u'P': 556, u'\xd3': 722, u'\u0152': 889, u'T': 611, u'X': 722, u'\xdb': 722, u'\\': 278, u'\xdf': 500, u'\uff64': 500, u'`': 333, u'\xe3': 444, u'\uff62': 500, u'd': 500, u'\xe7': 444, u'\uff66': 500, u'h': 500, u'\xeb': 444, u'\uff6a': 500, u'l': 278, u'\xef': 278, u'\uff6e': 500, u'p': 500, u'\xf3': 500, u'\uff72': 500, u't': 278, u'\uff76': 500, u'x': 500, u'\xfb': 500, u'\uff7a': 500, u'|': 200, u'\xff': 500, u'\u017e': 444, u'\u0301': 333, u'\uff82': 500, u'\u0305': 500, u'\uff86': 500, u'\uff8a': 500, u'\uff8e': 500, u'\u2013': 500, u'\uff92': 500, u'\uff96': 500, u'\uff9a': 500, u'\uff9e': 500, u'#': 500, u'\xa4': 500, u"'": 180, u'\u203a': 333, u'+': 564, u'\xac': 564, u'/': 278, u'\u0131': 278, u'3': 500, u'7': 500, u'\xb8': 333, u';': 278, u'\xbc': 750, u'?': 444, u'\u0141': 611, u'\xc0': 722, u'C': 667, u'\xc4': 722, u'G': 722, u'\xc8': 611, u'K': 722, u'\xcc': 333, u'O': 722, u'\xd0': 722, u'S': 556, u'\u2022': 350, u'\xd4': 722, u'W': 944, u'\uff78': 500, u'\xd8': 722, u'[': 333, u'\xdc': 722, u'_': 500, u'\u0161': 389, u'\xe0': 444, u'c': 444, u'\uff65': 500, u'\xe4': 444, u'g': 500, u'\uff69': 500, u'\xe8': 444, u'k': 500, u'\uff6d': 500, u'\xec': 278, u'o': 500, u'\uff71': 500, u'\xf0': 500, u's': 389, u'\uff75': 500, u'\xf4': 500, u'w': 722, u'\uff79': 500, u'\xf8': 500, u'{': 480, u'\uff7e': 500, u'\u017d': 611, u'\xfc': 500, u'\u0300': 333, u'\uff83': 500, u'\u2002': 500, u'\u0304': 333, u'\uff87': 500, u'\u0308': 333, u'\uff8b': 500, u'\u030c': 333, u'\uff8f': 500, u'\uff93': 500, u'\u2012': 500, u'\uff97': 500, u'\uff9b': 500, u'\u201a': 333, u'\uff9f': 500, u'\u201e': 444, u'\xa1': 333, u'"': 408, u'\xa5': 500, u'&': 778, u'\xa9': 760, u'\u0328': 333, u'*': 500, u'\xad': 564, u'.': 250, u'\uffe8': 500, u'2': 500, u'\xb5': 500, u'6': 500, u'\xb9': 300, u':': 278, u'\xbd': 750, u'>': 564, u'\xc1': 722, u'\uff61': 500, u'B': 667, u'\xc5': 722, u'F': 556, u'\xc9': 611, u'J': 389, u'\xcd': 333, u'N': 722, u'\xd1': 722, u'\u203e': 500, u'R': 667, u'\xd5': 722, u'V': 722, u'\xd9': 722, u'Z': 611, u'\xdd': 722, u'^': 469, u'\xe1': 444, u'\u0160': 556, u'b': 500, u'\xe5': 444, u'\u2039': 333, u'f': 333, u'\xe9': 444, u'\uff68': 500, u'j': 278, u'\xed': 278, u'\uff6c': 500, u'n': 500, u'\xf1': 500, u'\uff70': 500, u'r': 333, u'\xf5': 500, u'\uff74': 500, u'v': 500, u'\xf9': 500, u'\u0178': 722, u'z': 444, u'\xfd': 500, u'\uff7c': 500, u'~': 333, u'\uff80': 500, u'\u0303': 333, u'\uff84': 500, u'\u0307': 333, u'\uff88': 500, u'\u030b': 333, u'\uff8c': 500, u'\u2011': 333, u'\uff90': 500, u'\uff94': 500, u'\uff98': 500, u'\uff9c': 500, u'\u2044': 167, u'!': 333, u'\xa2': 500, u'%': 833, u'\u0327': 333, u'\xa6': 200, u')': 333, u'\xaa': 276, u'-': 333, u'\xae': 760, u'1': 500, u'\xb2': 300, u'5': 500, u'9': 500, u'\xba': 310, u'=': 564, u'\xbe': 750, u'A': 722, u'\u01c0': 200, u'\xc2': 722, u'E': 611, u'\xc6': 889, u'I': 333, u'\xca': 611, u'M': 889, u'\xce': 333, u'Q': 722, u'\u0153': 722, u'\xd2': 722, u'U': 722, u'\xd6': 722, u'Y': 722, u'\ufb01': 556, u'\xda': 722, u']': 333, u'\xde': 556, u'a': 444, u'\uff63': 500, u'\xe2': 444, u'e': 444, u'\uff67': 500, u'\xe6': 667, u'i': 278, u'\uff7d': 500, u'\uff6b': 500, u'\xea': 444, u'm': 778, u'\uff6f': 500, u'\xee': 278, u'q': 500, u'\uff73': 500, u'\xf2': 500, u'u': 500, u'\uff77': 500, u'\xf6': 500, u'y': 500, u'\uff7b': 500, u'\xfa': 500, u'}': 480, u'\uff7f': 500, u'\xfe': 500}
|
||||
widthsByUnichar["HYGothic-Medium"] = {u' ': 500, u'$': 500, u'(': 500, u',': 500, u'0': 500, u'4': 500, u'8': 500, u'<': 500, u'@': 500, u'D': 500, u'H': 500, u'L': 500, u'P': 500, u'T': 500, u'X': 500, u'\\': 500, u'`': 500, u'd': 500, u'h': 500, u'l': 500, u'p': 500, u't': 500, u'x': 500, u'|': 500, u'#': 500, u"'": 500, u'+': 500, u'/': 500, u'3': 500, u'7': 500, u';': 500, u'?': 500, u'C': 500, u'G': 500, u'K': 500, u'O': 500, u'S': 500, u'W': 500, u'[': 500, u'_': 500, u'c': 500, u'g': 500, u'k': 500, u'o': 500, u's': 500, u'w': 500, u'{': 500, u'"': 500, u'&': 500, u'*': 500, u'.': 500, u'2': 500, u'6': 500, u':': 500, u'>': 500, u'B': 500, u'F': 500, u'J': 500, u'N': 500, u'R': 500, u'V': 500, u'Z': 500, u'^': 500, u'b': 500, u'f': 500, u'j': 500, u'n': 500, u'r': 500, u'v': 500, u'z': 500, u'!': 500, u'%': 500, u')': 500, u'-': 500, u'1': 500, u'5': 500, u'9': 500, u'=': 500, u'A': 500, u'E': 500, u'I': 500, u'M': 500, u'Q': 500, u'U': 500, u'Y': 500, u']': 500, u'a': 500, u'e': 500, u'i': 500, u'm': 500, u'q': 500, u'u': 500, u'y': 500, u'}': 500}
|
||||
|
||||
|
||||
#shift-jis saying 'This is Heisei-Minchou'
|
||||
message1 = '\202\261\202\352\202\315\225\275\220\254\226\276\222\251\202\305\202\267\201B'
|
||||
message2 = '\202\261\202\352\202\315\225\275\220\254\212p\203S\203V\203b\203N\202\305\202\267\201B'
|
||||
|
||||
##def pswidths(text):
|
||||
## words = text.split()
|
||||
## out = []
|
||||
## for word in words:
|
||||
## if word == '[':
|
||||
## out.append(word)
|
||||
## else:
|
||||
## out.append(word + ',')
|
||||
## return eval(''.join(out),{})
|
||||
@@ -0,0 +1,255 @@
|
||||
#Copyright ReportLab Europe Ltd. 2000-2017
|
||||
#see license.txt for license details
|
||||
#history https://hg.reportlab.com/hg-public/reportlab/log/tip/src/reportlab/pdfbase/_fontdata.py
|
||||
#$Header $
|
||||
__version__='3.3.0'
|
||||
__doc__="""Database of font related things
|
||||
|
||||
- standardFonts - tuple of the 14 standard string font names
|
||||
- standardEncodings - tuple of the known standard font names
|
||||
- encodings - a mapping object from standard encoding names (and minor variants)
|
||||
to the encoding vectors ie the tuple of string glyph names
|
||||
- widthsByFontGlyph - fontname x glyphname --> width of glyph
|
||||
- widthVectorsByFont - fontName -> vector of widths
|
||||
|
||||
This module defines a static, large data structure. At the request
|
||||
of the Jython project, we have split this off into separate modules
|
||||
as Jython cannot handle more than 64k of bytecode in the 'top level'
|
||||
code of a Python module.
|
||||
"""
|
||||
import os, sys
|
||||
|
||||
# mapping of name to width vector, starts empty until fonts are added
|
||||
# e.g. widths['Courier'] = [...600,600,600,...]
|
||||
widthVectorsByFont = {}
|
||||
fontsByName = {}
|
||||
fontsByBaseEnc = {}
|
||||
# this is a list of the standard 14 font names in Acrobat Reader
|
||||
standardFonts = (
|
||||
'Courier', 'Courier-Bold', 'Courier-Oblique', 'Courier-BoldOblique',
|
||||
'Helvetica', 'Helvetica-Bold', 'Helvetica-Oblique', 'Helvetica-BoldOblique',
|
||||
'Times-Roman', 'Times-Bold', 'Times-Italic', 'Times-BoldItalic',
|
||||
'Symbol','ZapfDingbats')
|
||||
|
||||
standardFontAttributes = {
|
||||
#family, bold, italic defined for basic ones
|
||||
'Courier':('Courier',0,0),
|
||||
'Courier-Bold':('Courier',1,0),
|
||||
'Courier-Oblique':('Courier',0,1),
|
||||
'Courier-BoldOblique':('Courier',1,1),
|
||||
|
||||
'Helvetica':('Helvetica',0,0),
|
||||
'Helvetica-Bold':('Helvetica',1,0),
|
||||
'Helvetica-Oblique':('Helvetica',0,1),
|
||||
'Helvetica-BoldOblique':('Helvetica',1,1),
|
||||
|
||||
'Times-Roman':('Times-Roman',0,0),
|
||||
'Times-Bold':('Times-Roman',1,0),
|
||||
'Times-Italic':('Times-Roman',0,1),
|
||||
'Times-BoldItalic':('Times-Roman',1,1),
|
||||
|
||||
'Symbol':('Symbol',0,0),
|
||||
'ZapfDingbats':('ZapfDingbats',0,0)
|
||||
|
||||
}
|
||||
|
||||
#this maps fontnames to the equivalent filename root.
|
||||
_font2fnrMapWin32 = {
|
||||
'symbol': 'sy______',
|
||||
'zapfdingbats': 'zd______',
|
||||
'helvetica': '_a______',
|
||||
'helvetica-bold': '_ab_____',
|
||||
'helvetica-boldoblique': '_abi____',
|
||||
'helvetica-oblique': '_ai_____',
|
||||
'times-bold': '_eb_____',
|
||||
'times-bolditalic': '_ebi____',
|
||||
'times-italic': '_ei_____',
|
||||
'times-roman': '_er_____',
|
||||
'courier-bold': 'cob_____',
|
||||
'courier-boldoblique': 'cobo____',
|
||||
'courier': 'com_____',
|
||||
'courier-oblique': 'coo_____',
|
||||
}
|
||||
if sys.platform in ('linux2',):
|
||||
_font2fnrMapLinux2 ={
|
||||
'symbol': 'Symbol',
|
||||
'zapfdingbats': 'ZapfDingbats',
|
||||
'helvetica': 'Arial',
|
||||
'helvetica-bold': 'Arial-Bold',
|
||||
'helvetica-boldoblique': 'Arial-BoldItalic',
|
||||
'helvetica-oblique': 'Arial-Italic',
|
||||
'times-bold': 'TimesNewRoman-Bold',
|
||||
'times-bolditalic':'TimesNewRoman-BoldItalic',
|
||||
'times-italic': 'TimesNewRoman-Italic',
|
||||
'times-roman': 'TimesNewRoman',
|
||||
'courier-bold': 'Courier-Bold',
|
||||
'courier-boldoblique': 'Courier-BoldOblique',
|
||||
'courier': 'Courier',
|
||||
'courier-oblique': 'Courier-Oblique',
|
||||
}
|
||||
_font2fnrMap = _font2fnrMapLinux2
|
||||
for k, v in _font2fnrMap.items():
|
||||
if k in _font2fnrMapWin32.keys():
|
||||
_font2fnrMapWin32[v.lower()] = _font2fnrMapWin32[k]
|
||||
del k, v
|
||||
else:
|
||||
_font2fnrMap = _font2fnrMapWin32
|
||||
|
||||
def _findFNR(fontName):
|
||||
return _font2fnrMap[fontName.lower()]
|
||||
|
||||
from reportlab.rl_config import T1SearchPath
|
||||
from reportlab.lib.utils import rl_isfile
|
||||
def _searchT1Dirs(n,rl_isfile=rl_isfile,T1SearchPath=T1SearchPath):
|
||||
assert T1SearchPath!=[], "No Type-1 font search path"
|
||||
for d in T1SearchPath:
|
||||
f = os.path.join(d,n)
|
||||
if rl_isfile(f): return f
|
||||
return None
|
||||
del T1SearchPath, rl_isfile
|
||||
|
||||
def findT1File(fontName,ext='.pfb'):
|
||||
if sys.platform in ('linux2',) and ext=='.pfb':
|
||||
try:
|
||||
f = _searchT1Dirs(_findFNR(fontName))
|
||||
if f: return f
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
f = _searchT1Dirs(_font2fnrMapWin32[fontName.lower()]+ext)
|
||||
if f: return f
|
||||
except:
|
||||
pass
|
||||
|
||||
return _searchT1Dirs(_findFNR(fontName)+ext)
|
||||
|
||||
# this lists the predefined font encodings - WinAnsi and MacRoman. We have
|
||||
# not added MacExpert - it's possible, but would complicate life and nobody
|
||||
# is asking. StandardEncoding means something special.
|
||||
standardEncodings = ('WinAnsiEncoding','MacRomanEncoding','StandardEncoding','SymbolEncoding','ZapfDingbatsEncoding','PDFDocEncoding', 'MacExpertEncoding')
|
||||
|
||||
#this is the global mapping of standard encodings to name vectors
|
||||
class _Name2StandardEncodingMap(dict):
|
||||
'''Trivial fake dictionary with some [] magic'''
|
||||
_XMap = {'winansi':'WinAnsiEncoding','macroman': 'MacRomanEncoding','standard':'StandardEncoding','symbol':'SymbolEncoding', 'zapfdingbats':'ZapfDingbatsEncoding','pdfdoc':'PDFDocEncoding', 'macexpert':'MacExpertEncoding'}
|
||||
def __setitem__(self,x,v):
|
||||
y = x.lower()
|
||||
if y[-8:]=='encoding': y = y[:-8]
|
||||
y = self._XMap[y]
|
||||
if y in self: raise IndexError('Encoding %s is already set' % y)
|
||||
dict.__setitem__(self,y,v)
|
||||
|
||||
def __getitem__(self,x):
|
||||
y = x.lower()
|
||||
if y[-8:]=='encoding': y = y[:-8]
|
||||
y = self._XMap[y]
|
||||
return dict.__getitem__(self,y)
|
||||
|
||||
encodings = _Name2StandardEncodingMap()
|
||||
|
||||
#due to compiled method size limits in Jython,
|
||||
#we pull these in from separate modules to keep this module
|
||||
#well under 64k. We might well be able to ditch many of
|
||||
#these anyway now we run on Unicode.
|
||||
|
||||
from reportlab.pdfbase._fontdata_enc_winansi import WinAnsiEncoding
|
||||
from reportlab.pdfbase._fontdata_enc_macroman import MacRomanEncoding
|
||||
from reportlab.pdfbase._fontdata_enc_standard import StandardEncoding
|
||||
from reportlab.pdfbase._fontdata_enc_symbol import SymbolEncoding
|
||||
from reportlab.pdfbase._fontdata_enc_zapfdingbats import ZapfDingbatsEncoding
|
||||
from reportlab.pdfbase._fontdata_enc_pdfdoc import PDFDocEncoding
|
||||
from reportlab.pdfbase._fontdata_enc_macexpert import MacExpertEncoding
|
||||
encodings.update({
|
||||
'WinAnsiEncoding': WinAnsiEncoding,
|
||||
'MacRomanEncoding': MacRomanEncoding,
|
||||
'StandardEncoding': StandardEncoding,
|
||||
'SymbolEncoding': SymbolEncoding,
|
||||
'ZapfDingbatsEncoding': ZapfDingbatsEncoding,
|
||||
'PDFDocEncoding': PDFDocEncoding,
|
||||
'MacExpertEncoding': MacExpertEncoding,
|
||||
})
|
||||
|
||||
ascent_descent = {
|
||||
'Courier': (629, -157),
|
||||
'Courier-Bold': (626, -142),
|
||||
'Courier-BoldOblique': (626, -142),
|
||||
'Courier-Oblique': (629, -157),
|
||||
'Helvetica': (718, -207),
|
||||
'Helvetica-Bold': (718, -207),
|
||||
'Helvetica-BoldOblique': (718, -207),
|
||||
'Helvetica-Oblique': (718, -207),
|
||||
'Times-Roman': (683, -217),
|
||||
'Times-Bold': (676, -205),
|
||||
'Times-BoldItalic': (699, -205),
|
||||
'Times-Italic': (683, -205),
|
||||
'Symbol': (0, 0),
|
||||
'ZapfDingbats': (0, 0)
|
||||
}
|
||||
|
||||
# ditto about 64k limit - profusion of external files
|
||||
import reportlab.pdfbase._fontdata_widths_courier
|
||||
import reportlab.pdfbase._fontdata_widths_courierbold
|
||||
import reportlab.pdfbase._fontdata_widths_courieroblique
|
||||
import reportlab.pdfbase._fontdata_widths_courierboldoblique
|
||||
import reportlab.pdfbase._fontdata_widths_helvetica
|
||||
import reportlab.pdfbase._fontdata_widths_helveticabold
|
||||
import reportlab.pdfbase._fontdata_widths_helveticaoblique
|
||||
import reportlab.pdfbase._fontdata_widths_helveticaboldoblique
|
||||
import reportlab.pdfbase._fontdata_widths_timesroman
|
||||
import reportlab.pdfbase._fontdata_widths_timesbold
|
||||
import reportlab.pdfbase._fontdata_widths_timesitalic
|
||||
import reportlab.pdfbase._fontdata_widths_timesbolditalic
|
||||
import reportlab.pdfbase._fontdata_widths_symbol
|
||||
import reportlab.pdfbase._fontdata_widths_zapfdingbats
|
||||
widthsByFontGlyph = {
|
||||
'Courier':
|
||||
reportlab.pdfbase._fontdata_widths_courier.widths,
|
||||
'Courier-Bold':
|
||||
reportlab.pdfbase._fontdata_widths_courierbold.widths,
|
||||
'Courier-Oblique':
|
||||
reportlab.pdfbase._fontdata_widths_courieroblique.widths,
|
||||
'Courier-BoldOblique':
|
||||
reportlab.pdfbase._fontdata_widths_courierboldoblique.widths,
|
||||
'Helvetica':
|
||||
reportlab.pdfbase._fontdata_widths_helvetica.widths,
|
||||
'Helvetica-Bold':
|
||||
reportlab.pdfbase._fontdata_widths_helveticabold.widths,
|
||||
'Helvetica-Oblique':
|
||||
reportlab.pdfbase._fontdata_widths_helveticaoblique.widths,
|
||||
'Helvetica-BoldOblique':
|
||||
reportlab.pdfbase._fontdata_widths_helveticaboldoblique.widths,
|
||||
'Times-Roman':
|
||||
reportlab.pdfbase._fontdata_widths_timesroman.widths,
|
||||
'Times-Bold':
|
||||
reportlab.pdfbase._fontdata_widths_timesbold.widths,
|
||||
'Times-Italic':
|
||||
reportlab.pdfbase._fontdata_widths_timesitalic.widths,
|
||||
'Times-BoldItalic':
|
||||
reportlab.pdfbase._fontdata_widths_timesbolditalic.widths,
|
||||
'Symbol':
|
||||
reportlab.pdfbase._fontdata_widths_symbol.widths,
|
||||
'ZapfDingbats':
|
||||
reportlab.pdfbase._fontdata_widths_zapfdingbats.widths,
|
||||
}
|
||||
|
||||
|
||||
#preserve the initial values here
|
||||
def _reset(
|
||||
initial_dicts=dict(
|
||||
ascent_descent=ascent_descent.copy(),
|
||||
fontsByBaseEnc=fontsByBaseEnc.copy(),
|
||||
fontsByName=fontsByName.copy(),
|
||||
standardFontAttributes=standardFontAttributes.copy(),
|
||||
widthVectorsByFont=widthVectorsByFont.copy(),
|
||||
widthsByFontGlyph=widthsByFontGlyph.copy(),
|
||||
)
|
||||
):
|
||||
for k,v in initial_dicts.items():
|
||||
d=globals()[k]
|
||||
d.clear()
|
||||
d.update(v)
|
||||
|
||||
from reportlab.rl_config import register_reset
|
||||
register_reset(_reset)
|
||||
del register_reset
|
||||
@@ -0,0 +1,28 @@
|
||||
MacExpertEncoding = (None, None, None, None, None, None, None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
|
||||
'space', 'exclamsmall', 'Hungarumlautsmall', 'centoldstyle', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall',
|
||||
'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen',
|
||||
'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle',
|
||||
'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', None,
|
||||
'threequartersemdash', None, 'questionsmall', None, None, None, None, 'Ethsmall', None, None, 'onequarter',
|
||||
'onehalf', 'threequarters', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds',
|
||||
None, None, None, None, None, None, 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', None,
|
||||
'parenrightinferior', 'Circumflexsmall', 'hypheninferior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall',
|
||||
'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall',
|
||||
'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall',
|
||||
'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', None, None, 'asuperior', 'centsuperior', None, None, None,
|
||||
None, 'Aacutesmall', 'Agravesmall', 'Acircumflexsmall', 'Adieresissmall', 'Atildesmall', 'Aringsmall',
|
||||
'Ccedillasmall', 'Eacutesmall', 'Egravesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Iacutesmall', 'Igravesmall',
|
||||
'Icircumflexsmall', 'Idieresissmall', 'Ntildesmall', 'Oacutesmall', 'Ogravesmall', 'Ocircumflexsmall',
|
||||
'Odieresissmall', 'Otildesmall', 'Uacutesmall', 'Ugravesmall', 'Ucircumflexsmall', 'Udieresissmall', None,
|
||||
'eightsuperior', 'fourinferior', 'threeinferior', 'sixinferior', 'eightinferior', 'seveninferior', 'Scaronsmall',
|
||||
None, 'centinferior', 'twoinferior', None, 'Dieresissmall', None, 'Caronsmall', 'osuperior', 'fiveinferior', None,
|
||||
'commainferior', 'periodinferior', 'Yacutesmall', None, 'dollarinferior', None, None, 'Thornsmall', None,
|
||||
'nineinferior', 'zeroinferior', 'Zcaronsmall', 'AEsmall', 'Oslashsmall', 'questiondownsmall', 'oneinferior',
|
||||
'Lslashsmall', None, None, None, None, None, None, 'Cedillasmall', None, None, None, None, None, 'OEsmall',
|
||||
'figuredash', 'hyphensuperior', None, None, None, None, 'exclamdownsmall', None, 'Ydieresissmall', None,
|
||||
'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior',
|
||||
'ninesuperior', 'zerosuperior', None, 'esuperior', 'rsuperior', 'tsuperior', None, None, 'isuperior', 'ssuperior',
|
||||
'dsuperior', None, None, None, None, None, 'lsuperior', 'Ogoneksmall', 'Brevesmall', 'Macronsmall', 'bsuperior',
|
||||
'nsuperior', 'msuperior', 'commasuperior', 'periodsuperior', 'Dotaccentsmall', 'Ringsmall', None, None, None, None)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
MacRomanEncoding = (
|
||||
None, None, None, None, None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None, None, 'space', 'exclam',
|
||||
'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand',
|
||||
'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma',
|
||||
'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four',
|
||||
'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less',
|
||||
'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F',
|
||||
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||
'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright',
|
||||
'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright',
|
||||
'asciitilde', None, 'Adieresis', 'Aring', 'Ccedilla', 'Eacute',
|
||||
'Ntilde', 'Odieresis', 'Udieresis', 'aacute', 'agrave', 'acircumflex',
|
||||
'adieresis', 'atilde', 'aring', 'ccedilla', 'eacute', 'egrave',
|
||||
'ecircumflex', 'edieresis', 'iacute', 'igrave', 'icircumflex',
|
||||
'idieresis', 'ntilde', 'oacute', 'ograve', 'ocircumflex', 'odieresis',
|
||||
'otilde', 'uacute', 'ugrave', 'ucircumflex', 'udieresis', 'dagger',
|
||||
'degree', 'cent', 'sterling', 'section', 'bullet', 'paragraph',
|
||||
'germandbls', 'registered', 'copyright', 'trademark', 'acute',
|
||||
'dieresis', None, 'AE', 'Oslash', None, 'plusminus', None, None, 'yen',
|
||||
'mu', None, None, None, None, None, 'ordfeminine', 'ordmasculine', None,
|
||||
'ae', 'oslash', 'questiondown', 'exclamdown', 'logicalnot', None, 'florin',
|
||||
None, None, 'guillemotleft', 'guillemotright', 'ellipsis', 'space', 'Agrave',
|
||||
'Atilde', 'Otilde', 'OE', 'oe', 'endash', 'emdash', 'quotedblleft',
|
||||
'quotedblright', 'quoteleft', 'quoteright', 'divide', None, 'ydieresis',
|
||||
'Ydieresis', 'fraction', 'currency', 'guilsinglleft', 'guilsinglright',
|
||||
'fi', 'fl', 'daggerdbl', 'periodcentered', 'quotesinglbase',
|
||||
'quotedblbase', 'perthousand', 'Acircumflex', 'Ecircumflex', 'Aacute',
|
||||
'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave',
|
||||
'Oacute', 'Ocircumflex', None, 'Ograve', 'Uacute', 'Ucircumflex',
|
||||
'Ugrave', 'dotlessi', 'circumflex', 'tilde', 'macron', 'breve',
|
||||
'dotaccent', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron')
|
||||
@@ -0,0 +1,22 @@
|
||||
PDFDocEncoding = (None, None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,
|
||||
None,None,None,None,None,"breve","caron","circumflex",
|
||||
"dotaccent","hungarumlaut","ogonek","ring","tilde","space","exclam","quotedbl","numbersign","dollar","percent",
|
||||
"ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero",
|
||||
"one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater",
|
||||
"question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X",
|
||||
"Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g",
|
||||
"h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright",
|
||||
"asciitilde",None,"bullet","dagger","daggerdbl","ellipsis","emdash","endash","florin","fraction","guilsinglleft",
|
||||
"guilsinglright","minus","perthousand","quotedblbase","quotedblleft","quotedblright","quoteleft","quoteright",
|
||||
"quotesinglbase","trademark","fi","fl","Lslash","OE","Scaron","Ydieresis","Zcaron","dotlessi","lslash","oe",
|
||||
"scaron","zcaron",None,"Euro","exclamdown","cent","sterling","currency","yen","brokenbar","section","dieresis",
|
||||
"copyright","ordfeminine","guillemotleft","logicalnot",None,"registered","macron","degree","plusminus","twosuperior",
|
||||
"threesuperior","acute","mu","paragraph","periodcentered","cedilla","onesuperior","ordmasculine","guillemotright",
|
||||
"onequarter","onehalf","threequarters","questiondown","Agrave","Aacute","Acircumflex","Atilde","Adieresis","Aring",
|
||||
"AE","Ccedilla","Egrave","Eacute","Ecircumflex","Edieresis","Igrave","Iacute","Icircumflex","Idieresis","Eth",
|
||||
"Ntilde","Ograve","Oacute","Ocircumflex","Otilde","Odieresis","multiply","Oslash","Ugrave","Uacute","Ucircumflex",
|
||||
"Udieresis","Yacute","Thorn","germandbls","agrave","aacute","acircumflex","atilde","adieresis","aring","ae",
|
||||
"ccedilla","egrave","eacute","ecircumflex","edieresis","igrave","iacute","icircumflex","idieresis","eth","ntilde",
|
||||
"ograve","oacute","ocircumflex","otilde","odieresis","divide","oslash","ugrave","uacute","ucircumflex","udieresis",
|
||||
"yacute","thorn","ydieresis")
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
StandardEncoding =(None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,"space","exclam",
|
||||
"quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus",
|
||||
"comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon",
|
||||
"semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O",
|
||||
"P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore",
|
||||
"quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y",
|
||||
"z","braceleft","bar","braceright","asciitilde",None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,
|
||||
None,None,None,"exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft",
|
||||
"guillemotleft","guilsinglleft","guilsinglright","fi","fl",None,"endash","dagger","daggerdbl","periodcentered",None,
|
||||
"paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand",
|
||||
None,"questiondown",None,"grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis",None,"ring",
|
||||
"cedilla",None,"hungarumlaut","ogonek","caron","emdash",None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,None,"AE",None,"ordfeminine",
|
||||
None,None,None,None,"Lslash","Oslash","OE","ordmasculine",None,None,None,None,None,"ae",None,None,None,"dotlessi",None,None,"lslash","oslash",
|
||||
"oe","germandbls",None,None,None,None)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
SymbolEncoding = (
|
||||
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 'space',
|
||||
'exclam', 'universal', 'numbersign', 'existential', 'percent', 'ampersand', 'suchthat',
|
||||
'parenleft', 'parenright', 'asteriskmath', 'plus', 'comma', 'minus', 'period', 'slash', 'zero',
|
||||
'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon',
|
||||
'less', 'equal', 'greater', 'question', 'congruent', 'Alpha', 'Beta', 'Chi', 'Delta', 'Epsilon',
|
||||
'Phi', 'Gamma', 'Eta', 'Iota', 'theta1', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Omicron', 'Pi', 'Theta',
|
||||
'Rho', 'Sigma', 'Tau', 'Upsilon', 'sigma1', 'Omega', 'Xi', 'Psi', 'Zeta', 'bracketleft',
|
||||
'therefore', 'bracketright', 'perpendicular', 'underscore', 'radicalex', 'alpha', 'beta', 'chi',
|
||||
'delta', 'epsilon', 'phi', 'gamma', 'eta', 'iota', 'phi1', 'kappa', 'lambda', 'mu', 'nu',
|
||||
'omicron', 'pi', 'theta', 'rho', 'sigma', 'tau', 'upsilon', 'omega1', 'omega', 'xi', 'psi', 'zeta',
|
||||
'braceleft', 'bar', 'braceright', 'similar', None, None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None, None, 'Euro', 'Upsilon1', 'minute', 'lessequal',
|
||||
'fraction', 'infinity', 'florin', 'club', 'diamond', 'heart', 'spade', 'arrowboth', 'arrowleft',
|
||||
'arrowup', 'arrowright', 'arrowdown', 'degree', 'plusminus', 'second', 'greaterequal', 'multiply',
|
||||
'proportional', 'partialdiff', 'bullet', 'divide', 'notequal', 'equivalence', 'approxequal',
|
||||
'ellipsis', 'arrowvertex', 'arrowhorizex', 'carriagereturn', 'aleph', 'Ifraktur', 'Rfraktur',
|
||||
'weierstrass', 'circlemultiply', 'circleplus', 'emptyset', 'intersection', 'union',
|
||||
'propersuperset', 'reflexsuperset', 'notsubset', 'propersubset', 'reflexsubset', 'element',
|
||||
'notelement', 'angle', 'gradient', 'registerserif', 'copyrightserif', 'trademarkserif', 'product',
|
||||
'radical', 'dotmath', 'logicalnot', 'logicaland', 'logicalor', 'arrowdblboth', 'arrowdblleft',
|
||||
'arrowdblup', 'arrowdblright', 'arrowdbldown', 'lozenge', 'angleleft', 'registersans',
|
||||
'copyrightsans', 'trademarksans', 'summation', 'parenlefttp', 'parenleftex', 'parenleftbt',
|
||||
'bracketlefttp', 'bracketleftex', 'bracketleftbt', 'bracelefttp', 'braceleftmid', 'braceleftbt',
|
||||
'braceex', None, 'angleright', 'integral', 'integraltp', 'integralex', 'integralbt',
|
||||
'parenrighttp', 'parenrightex', 'parenrightbt', 'bracketrighttp', 'bracketrightex',
|
||||
'bracketrightbt', 'bracerighttp', 'bracerightmid', 'bracerightbt', None)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
WinAnsiEncoding = (
|
||||
None, None, None, None, None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None, None, 'space', 'exclam',
|
||||
'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand',
|
||||
'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma',
|
||||
'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four',
|
||||
'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less',
|
||||
'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F',
|
||||
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||
'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright',
|
||||
'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright',
|
||||
'asciitilde', 'bullet', 'Euro', 'bullet', 'quotesinglbase', 'florin',
|
||||
'quotedblbase', 'ellipsis', 'dagger', 'daggerdbl', 'circumflex',
|
||||
'perthousand', 'Scaron', 'guilsinglleft', 'OE', 'bullet', 'Zcaron',
|
||||
'bullet', 'bullet', 'quoteleft', 'quoteright', 'quotedblleft',
|
||||
'quotedblright', 'bullet', 'endash', 'emdash', 'tilde', 'trademark',
|
||||
'scaron', 'guilsinglright', 'oe', 'bullet', 'zcaron', 'Ydieresis',
|
||||
'space', 'exclamdown', 'cent', 'sterling', 'currency', 'yen', 'brokenbar',
|
||||
'section', 'dieresis', 'copyright', 'ordfeminine', 'guillemotleft',
|
||||
'logicalnot', 'hyphen', 'registered', 'macron', 'degree', 'plusminus',
|
||||
'twosuperior', 'threesuperior', 'acute', 'mu', 'paragraph', 'periodcentered',
|
||||
'cedilla', 'onesuperior', 'ordmasculine', 'guillemotright', 'onequarter',
|
||||
'onehalf', 'threequarters', 'questiondown', 'Agrave', 'Aacute',
|
||||
'Acircumflex', 'Atilde', 'Adieresis', 'Aring', 'AE', 'Ccedilla',
|
||||
'Egrave', 'Eacute', 'Ecircumflex', 'Edieresis', 'Igrave', 'Iacute',
|
||||
'Icircumflex', 'Idieresis', 'Eth', 'Ntilde', 'Ograve', 'Oacute',
|
||||
'Ocircumflex', 'Otilde', 'Odieresis', 'multiply', 'Oslash', 'Ugrave',
|
||||
'Uacute', 'Ucircumflex', 'Udieresis', 'Yacute', 'Thorn', 'germandbls',
|
||||
'agrave', 'aacute', 'acircumflex', 'atilde', 'adieresis', 'aring', 'ae',
|
||||
'ccedilla', 'egrave', 'eacute', 'ecircumflex', 'edieresis', 'igrave',
|
||||
'iacute', 'icircumflex', 'idieresis', 'eth', 'ntilde', 'ograve', 'oacute',
|
||||
'ocircumflex', 'otilde', 'odieresis', 'divide', 'oslash', 'ugrave', 'uacute',
|
||||
'ucircumflex', 'udieresis', 'yacute', 'thorn', 'ydieresis')
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
ZapfDingbatsEncoding = ( None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
|
||||
'space', 'a1', 'a2', 'a202', 'a3', 'a4', 'a5', 'a119', 'a118', 'a117', 'a11', 'a12', 'a13', 'a14',
|
||||
'a15', 'a16', 'a105', 'a17', 'a18', 'a19', 'a20', 'a21', 'a22', 'a23', 'a24', 'a25', 'a26', 'a27',
|
||||
'a28', 'a6', 'a7', 'a8', 'a9', 'a10', 'a29', 'a30', 'a31', 'a32', 'a33', 'a34', 'a35', 'a36',
|
||||
'a37', 'a38', 'a39', 'a40', 'a41', 'a42', 'a43', 'a44', 'a45', 'a46', 'a47', 'a48', 'a49', 'a50',
|
||||
'a51', 'a52', 'a53', 'a54', 'a55', 'a56', 'a57', 'a58', 'a59', 'a60', 'a61', 'a62', 'a63', 'a64',
|
||||
'a65', 'a66', 'a67', 'a68', 'a69', 'a70', 'a71', 'a72', 'a73', 'a74', 'a203', 'a75', 'a204', 'a76',
|
||||
'a77', 'a78', 'a79', 'a81', 'a82', 'a83', 'a84', 'a97', 'a98', 'a99', 'a100', None, 'a89', 'a90',
|
||||
'a93', 'a94', 'a91', 'a92', 'a205', 'a85', 'a206', 'a86', 'a87', 'a88', 'a95', 'a96', None, None,
|
||||
None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None,
|
||||
None, 'a101', 'a102', 'a103', 'a104', 'a106', 'a107', 'a108', 'a112', 'a111', 'a110', 'a109',
|
||||
'a120', 'a121', 'a122', 'a123', 'a124', 'a125', 'a126', 'a127', 'a128', 'a129', 'a130', 'a131',
|
||||
'a132', 'a133', 'a134', 'a135', 'a136', 'a137', 'a138', 'a139', 'a140', 'a141', 'a142', 'a143',
|
||||
'a144', 'a145', 'a146', 'a147', 'a148', 'a149', 'a150', 'a151', 'a152', 'a153', 'a154', 'a155',
|
||||
'a156', 'a157', 'a158', 'a159', 'a160', 'a161', 'a163', 'a164', 'a196', 'a165', 'a192', 'a166',
|
||||
'a167', 'a168', 'a169', 'a170', 'a171', 'a172', 'a173', 'a162', 'a174', 'a175', 'a176', 'a177',
|
||||
'a178', 'a179', 'a193', 'a180', 'a199', 'a181', 'a200', 'a182', None, 'a201', 'a183', 'a184',
|
||||
'a197', 'a185', 'a194', 'a198', 'a186', 'a195', 'a187', 'a188', 'a189', 'a190', 'a191', None)
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
widths = {'A': 600,
|
||||
'AE': 600,
|
||||
'Aacute': 600,
|
||||
'Acircumflex': 600,
|
||||
'Adieresis': 600,
|
||||
'Agrave': 600,
|
||||
'Aring': 600,
|
||||
'Atilde': 600,
|
||||
'B': 600,
|
||||
'C': 600,
|
||||
'Ccedilla': 600,
|
||||
'D': 600,
|
||||
'E': 600,
|
||||
'Eacute': 600,
|
||||
'Ecircumflex': 600,
|
||||
'Edieresis': 600,
|
||||
'Egrave': 600,
|
||||
'Eth': 600,
|
||||
'Euro': 600,
|
||||
'F': 600,
|
||||
'G': 600,
|
||||
'H': 600,
|
||||
'I': 600,
|
||||
'Iacute': 600,
|
||||
'Icircumflex': 600,
|
||||
'Idieresis': 600,
|
||||
'Igrave': 600,
|
||||
'J': 600,
|
||||
'K': 600,
|
||||
'L': 600,
|
||||
'Lslash': 600,
|
||||
'M': 600,
|
||||
'N': 600,
|
||||
'Ntilde': 600,
|
||||
'O': 600,
|
||||
'OE': 600,
|
||||
'Oacute': 600,
|
||||
'Ocircumflex': 600,
|
||||
'Odieresis': 600,
|
||||
'Ograve': 600,
|
||||
'Oslash': 600,
|
||||
'Otilde': 600,
|
||||
'P': 600,
|
||||
'Q': 600,
|
||||
'R': 600,
|
||||
'S': 600,
|
||||
'Scaron': 600,
|
||||
'T': 600,
|
||||
'Thorn': 600,
|
||||
'U': 600,
|
||||
'Uacute': 600,
|
||||
'Ucircumflex': 600,
|
||||
'Udieresis': 600,
|
||||
'Ugrave': 600,
|
||||
'V': 600,
|
||||
'W': 600,
|
||||
'X': 600,
|
||||
'Y': 600,
|
||||
'Yacute': 600,
|
||||
'Ydieresis': 600,
|
||||
'Z': 600,
|
||||
'Zcaron': 600,
|
||||
'a': 600,
|
||||
'aacute': 600,
|
||||
'acircumflex': 600,
|
||||
'acute': 600,
|
||||
'adieresis': 600,
|
||||
'ae': 600,
|
||||
'agrave': 600,
|
||||
'ampersand': 600,
|
||||
'aring': 600,
|
||||
'asciicircum': 600,
|
||||
'asciitilde': 600,
|
||||
'asterisk': 600,
|
||||
'at': 600,
|
||||
'atilde': 600,
|
||||
'b': 600,
|
||||
'backslash': 600,
|
||||
'bar': 600,
|
||||
'braceleft': 600,
|
||||
'braceright': 600,
|
||||
'bracketleft': 600,
|
||||
'bracketright': 600,
|
||||
'breve': 600,
|
||||
'brokenbar': 600,
|
||||
'bullet': 600,
|
||||
'c': 600,
|
||||
'caron': 600,
|
||||
'ccedilla': 600,
|
||||
'cedilla': 600,
|
||||
'cent': 600,
|
||||
'circumflex': 600,
|
||||
'colon': 600,
|
||||
'comma': 600,
|
||||
'copyright': 600,
|
||||
'currency': 600,
|
||||
'd': 600,
|
||||
'dagger': 600,
|
||||
'daggerdbl': 600,
|
||||
'degree': 600,
|
||||
'dieresis': 600,
|
||||
'divide': 600,
|
||||
'dollar': 600,
|
||||
'dotaccent': 600,
|
||||
'dotlessi': 600,
|
||||
'e': 600,
|
||||
'eacute': 600,
|
||||
'ecircumflex': 600,
|
||||
'edieresis': 600,
|
||||
'egrave': 600,
|
||||
'eight': 600,
|
||||
'ellipsis': 600,
|
||||
'emdash': 600,
|
||||
'endash': 600,
|
||||
'equal': 600,
|
||||
'eth': 600,
|
||||
'exclam': 600,
|
||||
'exclamdown': 600,
|
||||
'f': 600,
|
||||
'fi': 600,
|
||||
'five': 600,
|
||||
'fl': 600,
|
||||
'florin': 600,
|
||||
'four': 600,
|
||||
'fraction': 600,
|
||||
'g': 600,
|
||||
'germandbls': 600,
|
||||
'grave': 600,
|
||||
'greater': 600,
|
||||
'guillemotleft': 600,
|
||||
'guillemotright': 600,
|
||||
'guilsinglleft': 600,
|
||||
'guilsinglright': 600,
|
||||
'h': 600,
|
||||
'hungarumlaut': 600,
|
||||
'hyphen': 600,
|
||||
'i': 600,
|
||||
'iacute': 600,
|
||||
'icircumflex': 600,
|
||||
'idieresis': 600,
|
||||
'igrave': 600,
|
||||
'j': 600,
|
||||
'k': 600,
|
||||
'l': 600,
|
||||
'less': 600,
|
||||
'logicalnot': 600,
|
||||
'lslash': 600,
|
||||
'm': 600,
|
||||
'macron': 600,
|
||||
'minus': 600,
|
||||
'mu': 600,
|
||||
'multiply': 600,
|
||||
'n': 600,
|
||||
'nine': 600,
|
||||
'ntilde': 600,
|
||||
'numbersign': 600,
|
||||
'o': 600,
|
||||
'oacute': 600,
|
||||
'ocircumflex': 600,
|
||||
'odieresis': 600,
|
||||
'oe': 600,
|
||||
'ogonek': 600,
|
||||
'ograve': 600,
|
||||
'one': 600,
|
||||
'onehalf': 600,
|
||||
'onequarter': 600,
|
||||
'onesuperior': 600,
|
||||
'ordfeminine': 600,
|
||||
'ordmasculine': 600,
|
||||
'oslash': 600,
|
||||
'otilde': 600,
|
||||
'p': 600,
|
||||
'paragraph': 600,
|
||||
'parenleft': 600,
|
||||
'parenright': 600,
|
||||
'percent': 600,
|
||||
'period': 600,
|
||||
'periodcentered': 600,
|
||||
'perthousand': 600,
|
||||
'plus': 600,
|
||||
'plusminus': 600,
|
||||
'q': 600,
|
||||
'question': 600,
|
||||
'questiondown': 600,
|
||||
'quotedbl': 600,
|
||||
'quotedblbase': 600,
|
||||
'quotedblleft': 600,
|
||||
'quotedblright': 600,
|
||||
'quoteleft': 600,
|
||||
'quoteright': 600,
|
||||
'quotesinglbase': 600,
|
||||
'quotesingle': 600,
|
||||
'r': 600,
|
||||
'registered': 600,
|
||||
'ring': 600,
|
||||
's': 600,
|
||||
'scaron': 600,
|
||||
'section': 600,
|
||||
'semicolon': 600,
|
||||
'seven': 600,
|
||||
'six': 600,
|
||||
'slash': 600,
|
||||
'space': 600,
|
||||
'sterling': 600,
|
||||
't': 600,
|
||||
'thorn': 600,
|
||||
'three': 600,
|
||||
'threequarters': 600,
|
||||
'threesuperior': 600,
|
||||
'tilde': 600,
|
||||
'trademark': 600,
|
||||
'two': 600,
|
||||
'twosuperior': 600,
|
||||
'u': 600,
|
||||
'uacute': 600,
|
||||
'ucircumflex': 600,
|
||||
'udieresis': 600,
|
||||
'ugrave': 600,
|
||||
'underscore': 600,
|
||||
'v': 600,
|
||||
'w': 600,
|
||||
'x': 600,
|
||||
'y': 600,
|
||||
'yacute': 600,
|
||||
'ydieresis': 600,
|
||||
'yen': 600,
|
||||
'z': 600,
|
||||
'zcaron': 600,
|
||||
'zero': 600}
|
||||
@@ -0,0 +1,229 @@
|
||||
widths = {'A': 600,
|
||||
'AE': 600,
|
||||
'Aacute': 600,
|
||||
'Acircumflex': 600,
|
||||
'Adieresis': 600,
|
||||
'Agrave': 600,
|
||||
'Aring': 600,
|
||||
'Atilde': 600,
|
||||
'B': 600,
|
||||
'C': 600,
|
||||
'Ccedilla': 600,
|
||||
'D': 600,
|
||||
'E': 600,
|
||||
'Eacute': 600,
|
||||
'Ecircumflex': 600,
|
||||
'Edieresis': 600,
|
||||
'Egrave': 600,
|
||||
'Eth': 600,
|
||||
'Euro': 600,
|
||||
'F': 600,
|
||||
'G': 600,
|
||||
'H': 600,
|
||||
'I': 600,
|
||||
'Iacute': 600,
|
||||
'Icircumflex': 600,
|
||||
'Idieresis': 600,
|
||||
'Igrave': 600,
|
||||
'J': 600,
|
||||
'K': 600,
|
||||
'L': 600,
|
||||
'Lslash': 600,
|
||||
'M': 600,
|
||||
'N': 600,
|
||||
'Ntilde': 600,
|
||||
'O': 600,
|
||||
'OE': 600,
|
||||
'Oacute': 600,
|
||||
'Ocircumflex': 600,
|
||||
'Odieresis': 600,
|
||||
'Ograve': 600,
|
||||
'Oslash': 600,
|
||||
'Otilde': 600,
|
||||
'P': 600,
|
||||
'Q': 600,
|
||||
'R': 600,
|
||||
'S': 600,
|
||||
'Scaron': 600,
|
||||
'T': 600,
|
||||
'Thorn': 600,
|
||||
'U': 600,
|
||||
'Uacute': 600,
|
||||
'Ucircumflex': 600,
|
||||
'Udieresis': 600,
|
||||
'Ugrave': 600,
|
||||
'V': 600,
|
||||
'W': 600,
|
||||
'X': 600,
|
||||
'Y': 600,
|
||||
'Yacute': 600,
|
||||
'Ydieresis': 600,
|
||||
'Z': 600,
|
||||
'Zcaron': 600,
|
||||
'a': 600,
|
||||
'aacute': 600,
|
||||
'acircumflex': 600,
|
||||
'acute': 600,
|
||||
'adieresis': 600,
|
||||
'ae': 600,
|
||||
'agrave': 600,
|
||||
'ampersand': 600,
|
||||
'aring': 600,
|
||||
'asciicircum': 600,
|
||||
'asciitilde': 600,
|
||||
'asterisk': 600,
|
||||
'at': 600,
|
||||
'atilde': 600,
|
||||
'b': 600,
|
||||
'backslash': 600,
|
||||
'bar': 600,
|
||||
'braceleft': 600,
|
||||
'braceright': 600,
|
||||
'bracketleft': 600,
|
||||
'bracketright': 600,
|
||||
'breve': 600,
|
||||
'brokenbar': 600,
|
||||
'bullet': 600,
|
||||
'c': 600,
|
||||
'caron': 600,
|
||||
'ccedilla': 600,
|
||||
'cedilla': 600,
|
||||
'cent': 600,
|
||||
'circumflex': 600,
|
||||
'colon': 600,
|
||||
'comma': 600,
|
||||
'copyright': 600,
|
||||
'currency': 600,
|
||||
'd': 600,
|
||||
'dagger': 600,
|
||||
'daggerdbl': 600,
|
||||
'degree': 600,
|
||||
'dieresis': 600,
|
||||
'divide': 600,
|
||||
'dollar': 600,
|
||||
'dotaccent': 600,
|
||||
'dotlessi': 600,
|
||||
'e': 600,
|
||||
'eacute': 600,
|
||||
'ecircumflex': 600,
|
||||
'edieresis': 600,
|
||||
'egrave': 600,
|
||||
'eight': 600,
|
||||
'ellipsis': 600,
|
||||
'emdash': 600,
|
||||
'endash': 600,
|
||||
'equal': 600,
|
||||
'eth': 600,
|
||||
'exclam': 600,
|
||||
'exclamdown': 600,
|
||||
'f': 600,
|
||||
'fi': 600,
|
||||
'five': 600,
|
||||
'fl': 600,
|
||||
'florin': 600,
|
||||
'four': 600,
|
||||
'fraction': 600,
|
||||
'g': 600,
|
||||
'germandbls': 600,
|
||||
'grave': 600,
|
||||
'greater': 600,
|
||||
'guillemotleft': 600,
|
||||
'guillemotright': 600,
|
||||
'guilsinglleft': 600,
|
||||
'guilsinglright': 600,
|
||||
'h': 600,
|
||||
'hungarumlaut': 600,
|
||||
'hyphen': 600,
|
||||
'i': 600,
|
||||
'iacute': 600,
|
||||
'icircumflex': 600,
|
||||
'idieresis': 600,
|
||||
'igrave': 600,
|
||||
'j': 600,
|
||||
'k': 600,
|
||||
'l': 600,
|
||||
'less': 600,
|
||||
'logicalnot': 600,
|
||||
'lslash': 600,
|
||||
'm': 600,
|
||||
'macron': 600,
|
||||
'minus': 600,
|
||||
'mu': 600,
|
||||
'multiply': 600,
|
||||
'n': 600,
|
||||
'nine': 600,
|
||||
'ntilde': 600,
|
||||
'numbersign': 600,
|
||||
'o': 600,
|
||||
'oacute': 600,
|
||||
'ocircumflex': 600,
|
||||
'odieresis': 600,
|
||||
'oe': 600,
|
||||
'ogonek': 600,
|
||||
'ograve': 600,
|
||||
'one': 600,
|
||||
'onehalf': 600,
|
||||
'onequarter': 600,
|
||||
'onesuperior': 600,
|
||||
'ordfeminine': 600,
|
||||
'ordmasculine': 600,
|
||||
'oslash': 600,
|
||||
'otilde': 600,
|
||||
'p': 600,
|
||||
'paragraph': 600,
|
||||
'parenleft': 600,
|
||||
'parenright': 600,
|
||||
'percent': 600,
|
||||
'period': 600,
|
||||
'periodcentered': 600,
|
||||
'perthousand': 600,
|
||||
'plus': 600,
|
||||
'plusminus': 600,
|
||||
'q': 600,
|
||||
'question': 600,
|
||||
'questiondown': 600,
|
||||
'quotedbl': 600,
|
||||
'quotedblbase': 600,
|
||||
'quotedblleft': 600,
|
||||
'quotedblright': 600,
|
||||
'quoteleft': 600,
|
||||
'quoteright': 600,
|
||||
'quotesinglbase': 600,
|
||||
'quotesingle': 600,
|
||||
'r': 600,
|
||||
'registered': 600,
|
||||
'ring': 600,
|
||||
's': 600,
|
||||
'scaron': 600,
|
||||
'section': 600,
|
||||
'semicolon': 600,
|
||||
'seven': 600,
|
||||
'six': 600,
|
||||
'slash': 600,
|
||||
'space': 600,
|
||||
'sterling': 600,
|
||||
't': 600,
|
||||
'thorn': 600,
|
||||
'three': 600,
|
||||
'threequarters': 600,
|
||||
'threesuperior': 600,
|
||||
'tilde': 600,
|
||||
'trademark': 600,
|
||||
'two': 600,
|
||||
'twosuperior': 600,
|
||||
'u': 600,
|
||||
'uacute': 600,
|
||||
'ucircumflex': 600,
|
||||
'udieresis': 600,
|
||||
'ugrave': 600,
|
||||
'underscore': 600,
|
||||
'v': 600,
|
||||
'w': 600,
|
||||
'x': 600,
|
||||
'y': 600,
|
||||
'yacute': 600,
|
||||
'ydieresis': 600,
|
||||
'yen': 600,
|
||||
'z': 600,
|
||||
'zcaron': 600,
|
||||
'zero': 600}
|
||||
+229
@@ -0,0 +1,229 @@
|
||||
widths = {'A': 600,
|
||||
'AE': 600,
|
||||
'Aacute': 600,
|
||||
'Acircumflex': 600,
|
||||
'Adieresis': 600,
|
||||
'Agrave': 600,
|
||||
'Aring': 600,
|
||||
'Atilde': 600,
|
||||
'B': 600,
|
||||
'C': 600,
|
||||
'Ccedilla': 600,
|
||||
'D': 600,
|
||||
'E': 600,
|
||||
'Eacute': 600,
|
||||
'Ecircumflex': 600,
|
||||
'Edieresis': 600,
|
||||
'Egrave': 600,
|
||||
'Eth': 600,
|
||||
'Euro': 600,
|
||||
'F': 600,
|
||||
'G': 600,
|
||||
'H': 600,
|
||||
'I': 600,
|
||||
'Iacute': 600,
|
||||
'Icircumflex': 600,
|
||||
'Idieresis': 600,
|
||||
'Igrave': 600,
|
||||
'J': 600,
|
||||
'K': 600,
|
||||
'L': 600,
|
||||
'Lslash': 600,
|
||||
'M': 600,
|
||||
'N': 600,
|
||||
'Ntilde': 600,
|
||||
'O': 600,
|
||||
'OE': 600,
|
||||
'Oacute': 600,
|
||||
'Ocircumflex': 600,
|
||||
'Odieresis': 600,
|
||||
'Ograve': 600,
|
||||
'Oslash': 600,
|
||||
'Otilde': 600,
|
||||
'P': 600,
|
||||
'Q': 600,
|
||||
'R': 600,
|
||||
'S': 600,
|
||||
'Scaron': 600,
|
||||
'T': 600,
|
||||
'Thorn': 600,
|
||||
'U': 600,
|
||||
'Uacute': 600,
|
||||
'Ucircumflex': 600,
|
||||
'Udieresis': 600,
|
||||
'Ugrave': 600,
|
||||
'V': 600,
|
||||
'W': 600,
|
||||
'X': 600,
|
||||
'Y': 600,
|
||||
'Yacute': 600,
|
||||
'Ydieresis': 600,
|
||||
'Z': 600,
|
||||
'Zcaron': 600,
|
||||
'a': 600,
|
||||
'aacute': 600,
|
||||
'acircumflex': 600,
|
||||
'acute': 600,
|
||||
'adieresis': 600,
|
||||
'ae': 600,
|
||||
'agrave': 600,
|
||||
'ampersand': 600,
|
||||
'aring': 600,
|
||||
'asciicircum': 600,
|
||||
'asciitilde': 600,
|
||||
'asterisk': 600,
|
||||
'at': 600,
|
||||
'atilde': 600,
|
||||
'b': 600,
|
||||
'backslash': 600,
|
||||
'bar': 600,
|
||||
'braceleft': 600,
|
||||
'braceright': 600,
|
||||
'bracketleft': 600,
|
||||
'bracketright': 600,
|
||||
'breve': 600,
|
||||
'brokenbar': 600,
|
||||
'bullet': 600,
|
||||
'c': 600,
|
||||
'caron': 600,
|
||||
'ccedilla': 600,
|
||||
'cedilla': 600,
|
||||
'cent': 600,
|
||||
'circumflex': 600,
|
||||
'colon': 600,
|
||||
'comma': 600,
|
||||
'copyright': 600,
|
||||
'currency': 600,
|
||||
'd': 600,
|
||||
'dagger': 600,
|
||||
'daggerdbl': 600,
|
||||
'degree': 600,
|
||||
'dieresis': 600,
|
||||
'divide': 600,
|
||||
'dollar': 600,
|
||||
'dotaccent': 600,
|
||||
'dotlessi': 600,
|
||||
'e': 600,
|
||||
'eacute': 600,
|
||||
'ecircumflex': 600,
|
||||
'edieresis': 600,
|
||||
'egrave': 600,
|
||||
'eight': 600,
|
||||
'ellipsis': 600,
|
||||
'emdash': 600,
|
||||
'endash': 600,
|
||||
'equal': 600,
|
||||
'eth': 600,
|
||||
'exclam': 600,
|
||||
'exclamdown': 600,
|
||||
'f': 600,
|
||||
'fi': 600,
|
||||
'five': 600,
|
||||
'fl': 600,
|
||||
'florin': 600,
|
||||
'four': 600,
|
||||
'fraction': 600,
|
||||
'g': 600,
|
||||
'germandbls': 600,
|
||||
'grave': 600,
|
||||
'greater': 600,
|
||||
'guillemotleft': 600,
|
||||
'guillemotright': 600,
|
||||
'guilsinglleft': 600,
|
||||
'guilsinglright': 600,
|
||||
'h': 600,
|
||||
'hungarumlaut': 600,
|
||||
'hyphen': 600,
|
||||
'i': 600,
|
||||
'iacute': 600,
|
||||
'icircumflex': 600,
|
||||
'idieresis': 600,
|
||||
'igrave': 600,
|
||||
'j': 600,
|
||||
'k': 600,
|
||||
'l': 600,
|
||||
'less': 600,
|
||||
'logicalnot': 600,
|
||||
'lslash': 600,
|
||||
'm': 600,
|
||||
'macron': 600,
|
||||
'minus': 600,
|
||||
'mu': 600,
|
||||
'multiply': 600,
|
||||
'n': 600,
|
||||
'nine': 600,
|
||||
'ntilde': 600,
|
||||
'numbersign': 600,
|
||||
'o': 600,
|
||||
'oacute': 600,
|
||||
'ocircumflex': 600,
|
||||
'odieresis': 600,
|
||||
'oe': 600,
|
||||
'ogonek': 600,
|
||||
'ograve': 600,
|
||||
'one': 600,
|
||||
'onehalf': 600,
|
||||
'onequarter': 600,
|
||||
'onesuperior': 600,
|
||||
'ordfeminine': 600,
|
||||
'ordmasculine': 600,
|
||||
'oslash': 600,
|
||||
'otilde': 600,
|
||||
'p': 600,
|
||||
'paragraph': 600,
|
||||
'parenleft': 600,
|
||||
'parenright': 600,
|
||||
'percent': 600,
|
||||
'period': 600,
|
||||
'periodcentered': 600,
|
||||
'perthousand': 600,
|
||||
'plus': 600,
|
||||
'plusminus': 600,
|
||||
'q': 600,
|
||||
'question': 600,
|
||||
'questiondown': 600,
|
||||
'quotedbl': 600,
|
||||
'quotedblbase': 600,
|
||||
'quotedblleft': 600,
|
||||
'quotedblright': 600,
|
||||
'quoteleft': 600,
|
||||
'quoteright': 600,
|
||||
'quotesinglbase': 600,
|
||||
'quotesingle': 600,
|
||||
'r': 600,
|
||||
'registered': 600,
|
||||
'ring': 600,
|
||||
's': 600,
|
||||
'scaron': 600,
|
||||
'section': 600,
|
||||
'semicolon': 600,
|
||||
'seven': 600,
|
||||
'six': 600,
|
||||
'slash': 600,
|
||||
'space': 600,
|
||||
'sterling': 600,
|
||||
't': 600,
|
||||
'thorn': 600,
|
||||
'three': 600,
|
||||
'threequarters': 600,
|
||||
'threesuperior': 600,
|
||||
'tilde': 600,
|
||||
'trademark': 600,
|
||||
'two': 600,
|
||||
'twosuperior': 600,
|
||||
'u': 600,
|
||||
'uacute': 600,
|
||||
'ucircumflex': 600,
|
||||
'udieresis': 600,
|
||||
'ugrave': 600,
|
||||
'underscore': 600,
|
||||
'v': 600,
|
||||
'w': 600,
|
||||
'x': 600,
|
||||
'y': 600,
|
||||
'yacute': 600,
|
||||
'ydieresis': 600,
|
||||
'yen': 600,
|
||||
'z': 600,
|
||||
'zcaron': 600,
|
||||
'zero': 600}
|
||||
+229
@@ -0,0 +1,229 @@
|
||||
widths = {'A': 600,
|
||||
'AE': 600,
|
||||
'Aacute': 600,
|
||||
'Acircumflex': 600,
|
||||
'Adieresis': 600,
|
||||
'Agrave': 600,
|
||||
'Aring': 600,
|
||||
'Atilde': 600,
|
||||
'B': 600,
|
||||
'C': 600,
|
||||
'Ccedilla': 600,
|
||||
'D': 600,
|
||||
'E': 600,
|
||||
'Eacute': 600,
|
||||
'Ecircumflex': 600,
|
||||
'Edieresis': 600,
|
||||
'Egrave': 600,
|
||||
'Eth': 600,
|
||||
'Euro': 600,
|
||||
'F': 600,
|
||||
'G': 600,
|
||||
'H': 600,
|
||||
'I': 600,
|
||||
'Iacute': 600,
|
||||
'Icircumflex': 600,
|
||||
'Idieresis': 600,
|
||||
'Igrave': 600,
|
||||
'J': 600,
|
||||
'K': 600,
|
||||
'L': 600,
|
||||
'Lslash': 600,
|
||||
'M': 600,
|
||||
'N': 600,
|
||||
'Ntilde': 600,
|
||||
'O': 600,
|
||||
'OE': 600,
|
||||
'Oacute': 600,
|
||||
'Ocircumflex': 600,
|
||||
'Odieresis': 600,
|
||||
'Ograve': 600,
|
||||
'Oslash': 600,
|
||||
'Otilde': 600,
|
||||
'P': 600,
|
||||
'Q': 600,
|
||||
'R': 600,
|
||||
'S': 600,
|
||||
'Scaron': 600,
|
||||
'T': 600,
|
||||
'Thorn': 600,
|
||||
'U': 600,
|
||||
'Uacute': 600,
|
||||
'Ucircumflex': 600,
|
||||
'Udieresis': 600,
|
||||
'Ugrave': 600,
|
||||
'V': 600,
|
||||
'W': 600,
|
||||
'X': 600,
|
||||
'Y': 600,
|
||||
'Yacute': 600,
|
||||
'Ydieresis': 600,
|
||||
'Z': 600,
|
||||
'Zcaron': 600,
|
||||
'a': 600,
|
||||
'aacute': 600,
|
||||
'acircumflex': 600,
|
||||
'acute': 600,
|
||||
'adieresis': 600,
|
||||
'ae': 600,
|
||||
'agrave': 600,
|
||||
'ampersand': 600,
|
||||
'aring': 600,
|
||||
'asciicircum': 600,
|
||||
'asciitilde': 600,
|
||||
'asterisk': 600,
|
||||
'at': 600,
|
||||
'atilde': 600,
|
||||
'b': 600,
|
||||
'backslash': 600,
|
||||
'bar': 600,
|
||||
'braceleft': 600,
|
||||
'braceright': 600,
|
||||
'bracketleft': 600,
|
||||
'bracketright': 600,
|
||||
'breve': 600,
|
||||
'brokenbar': 600,
|
||||
'bullet': 600,
|
||||
'c': 600,
|
||||
'caron': 600,
|
||||
'ccedilla': 600,
|
||||
'cedilla': 600,
|
||||
'cent': 600,
|
||||
'circumflex': 600,
|
||||
'colon': 600,
|
||||
'comma': 600,
|
||||
'copyright': 600,
|
||||
'currency': 600,
|
||||
'd': 600,
|
||||
'dagger': 600,
|
||||
'daggerdbl': 600,
|
||||
'degree': 600,
|
||||
'dieresis': 600,
|
||||
'divide': 600,
|
||||
'dollar': 600,
|
||||
'dotaccent': 600,
|
||||
'dotlessi': 600,
|
||||
'e': 600,
|
||||
'eacute': 600,
|
||||
'ecircumflex': 600,
|
||||
'edieresis': 600,
|
||||
'egrave': 600,
|
||||
'eight': 600,
|
||||
'ellipsis': 600,
|
||||
'emdash': 600,
|
||||
'endash': 600,
|
||||
'equal': 600,
|
||||
'eth': 600,
|
||||
'exclam': 600,
|
||||
'exclamdown': 600,
|
||||
'f': 600,
|
||||
'fi': 600,
|
||||
'five': 600,
|
||||
'fl': 600,
|
||||
'florin': 600,
|
||||
'four': 600,
|
||||
'fraction': 600,
|
||||
'g': 600,
|
||||
'germandbls': 600,
|
||||
'grave': 600,
|
||||
'greater': 600,
|
||||
'guillemotleft': 600,
|
||||
'guillemotright': 600,
|
||||
'guilsinglleft': 600,
|
||||
'guilsinglright': 600,
|
||||
'h': 600,
|
||||
'hungarumlaut': 600,
|
||||
'hyphen': 600,
|
||||
'i': 600,
|
||||
'iacute': 600,
|
||||
'icircumflex': 600,
|
||||
'idieresis': 600,
|
||||
'igrave': 600,
|
||||
'j': 600,
|
||||
'k': 600,
|
||||
'l': 600,
|
||||
'less': 600,
|
||||
'logicalnot': 600,
|
||||
'lslash': 600,
|
||||
'm': 600,
|
||||
'macron': 600,
|
||||
'minus': 600,
|
||||
'mu': 600,
|
||||
'multiply': 600,
|
||||
'n': 600,
|
||||
'nine': 600,
|
||||
'ntilde': 600,
|
||||
'numbersign': 600,
|
||||
'o': 600,
|
||||
'oacute': 600,
|
||||
'ocircumflex': 600,
|
||||
'odieresis': 600,
|
||||
'oe': 600,
|
||||
'ogonek': 600,
|
||||
'ograve': 600,
|
||||
'one': 600,
|
||||
'onehalf': 600,
|
||||
'onequarter': 600,
|
||||
'onesuperior': 600,
|
||||
'ordfeminine': 600,
|
||||
'ordmasculine': 600,
|
||||
'oslash': 600,
|
||||
'otilde': 600,
|
||||
'p': 600,
|
||||
'paragraph': 600,
|
||||
'parenleft': 600,
|
||||
'parenright': 600,
|
||||
'percent': 600,
|
||||
'period': 600,
|
||||
'periodcentered': 600,
|
||||
'perthousand': 600,
|
||||
'plus': 600,
|
||||
'plusminus': 600,
|
||||
'q': 600,
|
||||
'question': 600,
|
||||
'questiondown': 600,
|
||||
'quotedbl': 600,
|
||||
'quotedblbase': 600,
|
||||
'quotedblleft': 600,
|
||||
'quotedblright': 600,
|
||||
'quoteleft': 600,
|
||||
'quoteright': 600,
|
||||
'quotesinglbase': 600,
|
||||
'quotesingle': 600,
|
||||
'r': 600,
|
||||
'registered': 600,
|
||||
'ring': 600,
|
||||
's': 600,
|
||||
'scaron': 600,
|
||||
'section': 600,
|
||||
'semicolon': 600,
|
||||
'seven': 600,
|
||||
'six': 600,
|
||||
'slash': 600,
|
||||
'space': 600,
|
||||
'sterling': 600,
|
||||
't': 600,
|
||||
'thorn': 600,
|
||||
'three': 600,
|
||||
'threequarters': 600,
|
||||
'threesuperior': 600,
|
||||
'tilde': 600,
|
||||
'trademark': 600,
|
||||
'two': 600,
|
||||
'twosuperior': 600,
|
||||
'u': 600,
|
||||
'uacute': 600,
|
||||
'ucircumflex': 600,
|
||||
'udieresis': 600,
|
||||
'ugrave': 600,
|
||||
'underscore': 600,
|
||||
'v': 600,
|
||||
'w': 600,
|
||||
'x': 600,
|
||||
'y': 600,
|
||||
'yacute': 600,
|
||||
'ydieresis': 600,
|
||||
'yen': 600,
|
||||
'z': 600,
|
||||
'zcaron': 600,
|
||||
'zero': 600}
|
||||
@@ -0,0 +1,229 @@
|
||||
widths = {'A': 667,
|
||||
'AE': 1000,
|
||||
'Aacute': 667,
|
||||
'Acircumflex': 667,
|
||||
'Adieresis': 667,
|
||||
'Agrave': 667,
|
||||
'Aring': 667,
|
||||
'Atilde': 667,
|
||||
'B': 667,
|
||||
'C': 722,
|
||||
'Ccedilla': 722,
|
||||
'D': 722,
|
||||
'E': 667,
|
||||
'Eacute': 667,
|
||||
'Ecircumflex': 667,
|
||||
'Edieresis': 667,
|
||||
'Egrave': 667,
|
||||
'Eth': 722,
|
||||
'Euro': 556,
|
||||
'F': 611,
|
||||
'G': 778,
|
||||
'H': 722,
|
||||
'I': 278,
|
||||
'Iacute': 278,
|
||||
'Icircumflex': 278,
|
||||
'Idieresis': 278,
|
||||
'Igrave': 278,
|
||||
'J': 500,
|
||||
'K': 667,
|
||||
'L': 556,
|
||||
'Lslash': 556,
|
||||
'M': 833,
|
||||
'N': 722,
|
||||
'Ntilde': 722,
|
||||
'O': 778,
|
||||
'OE': 1000,
|
||||
'Oacute': 778,
|
||||
'Ocircumflex': 778,
|
||||
'Odieresis': 778,
|
||||
'Ograve': 778,
|
||||
'Oslash': 778,
|
||||
'Otilde': 778,
|
||||
'P': 667,
|
||||
'Q': 778,
|
||||
'R': 722,
|
||||
'S': 667,
|
||||
'Scaron': 667,
|
||||
'T': 611,
|
||||
'Thorn': 667,
|
||||
'U': 722,
|
||||
'Uacute': 722,
|
||||
'Ucircumflex': 722,
|
||||
'Udieresis': 722,
|
||||
'Ugrave': 722,
|
||||
'V': 667,
|
||||
'W': 944,
|
||||
'X': 667,
|
||||
'Y': 667,
|
||||
'Yacute': 667,
|
||||
'Ydieresis': 667,
|
||||
'Z': 611,
|
||||
'Zcaron': 611,
|
||||
'a': 556,
|
||||
'aacute': 556,
|
||||
'acircumflex': 556,
|
||||
'acute': 333,
|
||||
'adieresis': 556,
|
||||
'ae': 889,
|
||||
'agrave': 556,
|
||||
'ampersand': 667,
|
||||
'aring': 556,
|
||||
'asciicircum': 469,
|
||||
'asciitilde': 584,
|
||||
'asterisk': 389,
|
||||
'at': 1015,
|
||||
'atilde': 556,
|
||||
'b': 556,
|
||||
'backslash': 278,
|
||||
'bar': 260,
|
||||
'braceleft': 334,
|
||||
'braceright': 334,
|
||||
'bracketleft': 278,
|
||||
'bracketright': 278,
|
||||
'breve': 333,
|
||||
'brokenbar': 260,
|
||||
'bullet': 350,
|
||||
'c': 500,
|
||||
'caron': 333,
|
||||
'ccedilla': 500,
|
||||
'cedilla': 333,
|
||||
'cent': 556,
|
||||
'circumflex': 333,
|
||||
'colon': 278,
|
||||
'comma': 278,
|
||||
'copyright': 737,
|
||||
'currency': 556,
|
||||
'd': 556,
|
||||
'dagger': 556,
|
||||
'daggerdbl': 556,
|
||||
'degree': 400,
|
||||
'dieresis': 333,
|
||||
'divide': 584,
|
||||
'dollar': 556,
|
||||
'dotaccent': 333,
|
||||
'dotlessi': 278,
|
||||
'e': 556,
|
||||
'eacute': 556,
|
||||
'ecircumflex': 556,
|
||||
'edieresis': 556,
|
||||
'egrave': 556,
|
||||
'eight': 556,
|
||||
'ellipsis': 1000,
|
||||
'emdash': 1000,
|
||||
'endash': 556,
|
||||
'equal': 584,
|
||||
'eth': 556,
|
||||
'exclam': 278,
|
||||
'exclamdown': 333,
|
||||
'f': 278,
|
||||
'fi': 500,
|
||||
'five': 556,
|
||||
'fl': 500,
|
||||
'florin': 556,
|
||||
'four': 556,
|
||||
'fraction': 167,
|
||||
'g': 556,
|
||||
'germandbls': 611,
|
||||
'grave': 333,
|
||||
'greater': 584,
|
||||
'guillemotleft': 556,
|
||||
'guillemotright': 556,
|
||||
'guilsinglleft': 333,
|
||||
'guilsinglright': 333,
|
||||
'h': 556,
|
||||
'hungarumlaut': 333,
|
||||
'hyphen': 333,
|
||||
'i': 222,
|
||||
'iacute': 278,
|
||||
'icircumflex': 278,
|
||||
'idieresis': 278,
|
||||
'igrave': 278,
|
||||
'j': 222,
|
||||
'k': 500,
|
||||
'l': 222,
|
||||
'less': 584,
|
||||
'logicalnot': 584,
|
||||
'lslash': 222,
|
||||
'm': 833,
|
||||
'macron': 333,
|
||||
'minus': 584,
|
||||
'mu': 556,
|
||||
'multiply': 584,
|
||||
'n': 556,
|
||||
'nine': 556,
|
||||
'ntilde': 556,
|
||||
'numbersign': 556,
|
||||
'o': 556,
|
||||
'oacute': 556,
|
||||
'ocircumflex': 556,
|
||||
'odieresis': 556,
|
||||
'oe': 944,
|
||||
'ogonek': 333,
|
||||
'ograve': 556,
|
||||
'one': 556,
|
||||
'onehalf': 834,
|
||||
'onequarter': 834,
|
||||
'onesuperior': 333,
|
||||
'ordfeminine': 370,
|
||||
'ordmasculine': 365,
|
||||
'oslash': 611,
|
||||
'otilde': 556,
|
||||
'p': 556,
|
||||
'paragraph': 537,
|
||||
'parenleft': 333,
|
||||
'parenright': 333,
|
||||
'percent': 889,
|
||||
'period': 278,
|
||||
'periodcentered': 278,
|
||||
'perthousand': 1000,
|
||||
'plus': 584,
|
||||
'plusminus': 584,
|
||||
'q': 556,
|
||||
'question': 556,
|
||||
'questiondown': 611,
|
||||
'quotedbl': 355,
|
||||
'quotedblbase': 333,
|
||||
'quotedblleft': 333,
|
||||
'quotedblright': 333,
|
||||
'quoteleft': 222,
|
||||
'quoteright': 222,
|
||||
'quotesinglbase': 222,
|
||||
'quotesingle': 191,
|
||||
'r': 333,
|
||||
'registered': 737,
|
||||
'ring': 333,
|
||||
's': 500,
|
||||
'scaron': 500,
|
||||
'section': 556,
|
||||
'semicolon': 278,
|
||||
'seven': 556,
|
||||
'six': 556,
|
||||
'slash': 278,
|
||||
'space': 278,
|
||||
'sterling': 556,
|
||||
't': 278,
|
||||
'thorn': 556,
|
||||
'three': 556,
|
||||
'threequarters': 834,
|
||||
'threesuperior': 333,
|
||||
'tilde': 333,
|
||||
'trademark': 1000,
|
||||
'two': 556,
|
||||
'twosuperior': 333,
|
||||
'u': 556,
|
||||
'uacute': 556,
|
||||
'ucircumflex': 556,
|
||||
'udieresis': 556,
|
||||
'ugrave': 556,
|
||||
'underscore': 556,
|
||||
'v': 500,
|
||||
'w': 722,
|
||||
'x': 500,
|
||||
'y': 500,
|
||||
'yacute': 500,
|
||||
'ydieresis': 500,
|
||||
'yen': 556,
|
||||
'z': 500,
|
||||
'zcaron': 500,
|
||||
'zero': 556}
|
||||
+229
@@ -0,0 +1,229 @@
|
||||
widths = {'A': 722,
|
||||
'AE': 1000,
|
||||
'Aacute': 722,
|
||||
'Acircumflex': 722,
|
||||
'Adieresis': 722,
|
||||
'Agrave': 722,
|
||||
'Aring': 722,
|
||||
'Atilde': 722,
|
||||
'B': 722,
|
||||
'C': 722,
|
||||
'Ccedilla': 722,
|
||||
'D': 722,
|
||||
'E': 667,
|
||||
'Eacute': 667,
|
||||
'Ecircumflex': 667,
|
||||
'Edieresis': 667,
|
||||
'Egrave': 667,
|
||||
'Eth': 722,
|
||||
'Euro': 556,
|
||||
'F': 611,
|
||||
'G': 778,
|
||||
'H': 722,
|
||||
'I': 278,
|
||||
'Iacute': 278,
|
||||
'Icircumflex': 278,
|
||||
'Idieresis': 278,
|
||||
'Igrave': 278,
|
||||
'J': 556,
|
||||
'K': 722,
|
||||
'L': 611,
|
||||
'Lslash': 611,
|
||||
'M': 833,
|
||||
'N': 722,
|
||||
'Ntilde': 722,
|
||||
'O': 778,
|
||||
'OE': 1000,
|
||||
'Oacute': 778,
|
||||
'Ocircumflex': 778,
|
||||
'Odieresis': 778,
|
||||
'Ograve': 778,
|
||||
'Oslash': 778,
|
||||
'Otilde': 778,
|
||||
'P': 667,
|
||||
'Q': 778,
|
||||
'R': 722,
|
||||
'S': 667,
|
||||
'Scaron': 667,
|
||||
'T': 611,
|
||||
'Thorn': 667,
|
||||
'U': 722,
|
||||
'Uacute': 722,
|
||||
'Ucircumflex': 722,
|
||||
'Udieresis': 722,
|
||||
'Ugrave': 722,
|
||||
'V': 667,
|
||||
'W': 944,
|
||||
'X': 667,
|
||||
'Y': 667,
|
||||
'Yacute': 667,
|
||||
'Ydieresis': 667,
|
||||
'Z': 611,
|
||||
'Zcaron': 611,
|
||||
'a': 556,
|
||||
'aacute': 556,
|
||||
'acircumflex': 556,
|
||||
'acute': 333,
|
||||
'adieresis': 556,
|
||||
'ae': 889,
|
||||
'agrave': 556,
|
||||
'ampersand': 722,
|
||||
'aring': 556,
|
||||
'asciicircum': 584,
|
||||
'asciitilde': 584,
|
||||
'asterisk': 389,
|
||||
'at': 975,
|
||||
'atilde': 556,
|
||||
'b': 611,
|
||||
'backslash': 278,
|
||||
'bar': 280,
|
||||
'braceleft': 389,
|
||||
'braceright': 389,
|
||||
'bracketleft': 333,
|
||||
'bracketright': 333,
|
||||
'breve': 333,
|
||||
'brokenbar': 280,
|
||||
'bullet': 350,
|
||||
'c': 556,
|
||||
'caron': 333,
|
||||
'ccedilla': 556,
|
||||
'cedilla': 333,
|
||||
'cent': 556,
|
||||
'circumflex': 333,
|
||||
'colon': 333,
|
||||
'comma': 278,
|
||||
'copyright': 737,
|
||||
'currency': 556,
|
||||
'd': 611,
|
||||
'dagger': 556,
|
||||
'daggerdbl': 556,
|
||||
'degree': 400,
|
||||
'dieresis': 333,
|
||||
'divide': 584,
|
||||
'dollar': 556,
|
||||
'dotaccent': 333,
|
||||
'dotlessi': 278,
|
||||
'e': 556,
|
||||
'eacute': 556,
|
||||
'ecircumflex': 556,
|
||||
'edieresis': 556,
|
||||
'egrave': 556,
|
||||
'eight': 556,
|
||||
'ellipsis': 1000,
|
||||
'emdash': 1000,
|
||||
'endash': 556,
|
||||
'equal': 584,
|
||||
'eth': 611,
|
||||
'exclam': 333,
|
||||
'exclamdown': 333,
|
||||
'f': 333,
|
||||
'fi': 611,
|
||||
'five': 556,
|
||||
'fl': 611,
|
||||
'florin': 556,
|
||||
'four': 556,
|
||||
'fraction': 167,
|
||||
'g': 611,
|
||||
'germandbls': 611,
|
||||
'grave': 333,
|
||||
'greater': 584,
|
||||
'guillemotleft': 556,
|
||||
'guillemotright': 556,
|
||||
'guilsinglleft': 333,
|
||||
'guilsinglright': 333,
|
||||
'h': 611,
|
||||
'hungarumlaut': 333,
|
||||
'hyphen': 333,
|
||||
'i': 278,
|
||||
'iacute': 278,
|
||||
'icircumflex': 278,
|
||||
'idieresis': 278,
|
||||
'igrave': 278,
|
||||
'j': 278,
|
||||
'k': 556,
|
||||
'l': 278,
|
||||
'less': 584,
|
||||
'logicalnot': 584,
|
||||
'lslash': 278,
|
||||
'm': 889,
|
||||
'macron': 333,
|
||||
'minus': 584,
|
||||
'mu': 611,
|
||||
'multiply': 584,
|
||||
'n': 611,
|
||||
'nine': 556,
|
||||
'ntilde': 611,
|
||||
'numbersign': 556,
|
||||
'o': 611,
|
||||
'oacute': 611,
|
||||
'ocircumflex': 611,
|
||||
'odieresis': 611,
|
||||
'oe': 944,
|
||||
'ogonek': 333,
|
||||
'ograve': 611,
|
||||
'one': 556,
|
||||
'onehalf': 834,
|
||||
'onequarter': 834,
|
||||
'onesuperior': 333,
|
||||
'ordfeminine': 370,
|
||||
'ordmasculine': 365,
|
||||
'oslash': 611,
|
||||
'otilde': 611,
|
||||
'p': 611,
|
||||
'paragraph': 556,
|
||||
'parenleft': 333,
|
||||
'parenright': 333,
|
||||
'percent': 889,
|
||||
'period': 278,
|
||||
'periodcentered': 278,
|
||||
'perthousand': 1000,
|
||||
'plus': 584,
|
||||
'plusminus': 584,
|
||||
'q': 611,
|
||||
'question': 611,
|
||||
'questiondown': 611,
|
||||
'quotedbl': 474,
|
||||
'quotedblbase': 500,
|
||||
'quotedblleft': 500,
|
||||
'quotedblright': 500,
|
||||
'quoteleft': 278,
|
||||
'quoteright': 278,
|
||||
'quotesinglbase': 278,
|
||||
'quotesingle': 238,
|
||||
'r': 389,
|
||||
'registered': 737,
|
||||
'ring': 333,
|
||||
's': 556,
|
||||
'scaron': 556,
|
||||
'section': 556,
|
||||
'semicolon': 333,
|
||||
'seven': 556,
|
||||
'six': 556,
|
||||
'slash': 278,
|
||||
'space': 278,
|
||||
'sterling': 556,
|
||||
't': 333,
|
||||
'thorn': 611,
|
||||
'three': 556,
|
||||
'threequarters': 834,
|
||||
'threesuperior': 333,
|
||||
'tilde': 333,
|
||||
'trademark': 1000,
|
||||
'two': 556,
|
||||
'twosuperior': 333,
|
||||
'u': 611,
|
||||
'uacute': 611,
|
||||
'ucircumflex': 611,
|
||||
'udieresis': 611,
|
||||
'ugrave': 611,
|
||||
'underscore': 556,
|
||||
'v': 556,
|
||||
'w': 778,
|
||||
'x': 556,
|
||||
'y': 556,
|
||||
'yacute': 556,
|
||||
'ydieresis': 556,
|
||||
'yen': 556,
|
||||
'z': 500,
|
||||
'zcaron': 500,
|
||||
'zero': 556}
|
||||
+229
@@ -0,0 +1,229 @@
|
||||
widths = {'A': 722,
|
||||
'AE': 1000,
|
||||
'Aacute': 722,
|
||||
'Acircumflex': 722,
|
||||
'Adieresis': 722,
|
||||
'Agrave': 722,
|
||||
'Aring': 722,
|
||||
'Atilde': 722,
|
||||
'B': 722,
|
||||
'C': 722,
|
||||
'Ccedilla': 722,
|
||||
'D': 722,
|
||||
'E': 667,
|
||||
'Eacute': 667,
|
||||
'Ecircumflex': 667,
|
||||
'Edieresis': 667,
|
||||
'Egrave': 667,
|
||||
'Eth': 722,
|
||||
'Euro': 556,
|
||||
'F': 611,
|
||||
'G': 778,
|
||||
'H': 722,
|
||||
'I': 278,
|
||||
'Iacute': 278,
|
||||
'Icircumflex': 278,
|
||||
'Idieresis': 278,
|
||||
'Igrave': 278,
|
||||
'J': 556,
|
||||
'K': 722,
|
||||
'L': 611,
|
||||
'Lslash': 611,
|
||||
'M': 833,
|
||||
'N': 722,
|
||||
'Ntilde': 722,
|
||||
'O': 778,
|
||||
'OE': 1000,
|
||||
'Oacute': 778,
|
||||
'Ocircumflex': 778,
|
||||
'Odieresis': 778,
|
||||
'Ograve': 778,
|
||||
'Oslash': 778,
|
||||
'Otilde': 778,
|
||||
'P': 667,
|
||||
'Q': 778,
|
||||
'R': 722,
|
||||
'S': 667,
|
||||
'Scaron': 667,
|
||||
'T': 611,
|
||||
'Thorn': 667,
|
||||
'U': 722,
|
||||
'Uacute': 722,
|
||||
'Ucircumflex': 722,
|
||||
'Udieresis': 722,
|
||||
'Ugrave': 722,
|
||||
'V': 667,
|
||||
'W': 944,
|
||||
'X': 667,
|
||||
'Y': 667,
|
||||
'Yacute': 667,
|
||||
'Ydieresis': 667,
|
||||
'Z': 611,
|
||||
'Zcaron': 611,
|
||||
'a': 556,
|
||||
'aacute': 556,
|
||||
'acircumflex': 556,
|
||||
'acute': 333,
|
||||
'adieresis': 556,
|
||||
'ae': 889,
|
||||
'agrave': 556,
|
||||
'ampersand': 722,
|
||||
'aring': 556,
|
||||
'asciicircum': 584,
|
||||
'asciitilde': 584,
|
||||
'asterisk': 389,
|
||||
'at': 975,
|
||||
'atilde': 556,
|
||||
'b': 611,
|
||||
'backslash': 278,
|
||||
'bar': 280,
|
||||
'braceleft': 389,
|
||||
'braceright': 389,
|
||||
'bracketleft': 333,
|
||||
'bracketright': 333,
|
||||
'breve': 333,
|
||||
'brokenbar': 280,
|
||||
'bullet': 350,
|
||||
'c': 556,
|
||||
'caron': 333,
|
||||
'ccedilla': 556,
|
||||
'cedilla': 333,
|
||||
'cent': 556,
|
||||
'circumflex': 333,
|
||||
'colon': 333,
|
||||
'comma': 278,
|
||||
'copyright': 737,
|
||||
'currency': 556,
|
||||
'd': 611,
|
||||
'dagger': 556,
|
||||
'daggerdbl': 556,
|
||||
'degree': 400,
|
||||
'dieresis': 333,
|
||||
'divide': 584,
|
||||
'dollar': 556,
|
||||
'dotaccent': 333,
|
||||
'dotlessi': 278,
|
||||
'e': 556,
|
||||
'eacute': 556,
|
||||
'ecircumflex': 556,
|
||||
'edieresis': 556,
|
||||
'egrave': 556,
|
||||
'eight': 556,
|
||||
'ellipsis': 1000,
|
||||
'emdash': 1000,
|
||||
'endash': 556,
|
||||
'equal': 584,
|
||||
'eth': 611,
|
||||
'exclam': 333,
|
||||
'exclamdown': 333,
|
||||
'f': 333,
|
||||
'fi': 611,
|
||||
'five': 556,
|
||||
'fl': 611,
|
||||
'florin': 556,
|
||||
'four': 556,
|
||||
'fraction': 167,
|
||||
'g': 611,
|
||||
'germandbls': 611,
|
||||
'grave': 333,
|
||||
'greater': 584,
|
||||
'guillemotleft': 556,
|
||||
'guillemotright': 556,
|
||||
'guilsinglleft': 333,
|
||||
'guilsinglright': 333,
|
||||
'h': 611,
|
||||
'hungarumlaut': 333,
|
||||
'hyphen': 333,
|
||||
'i': 278,
|
||||
'iacute': 278,
|
||||
'icircumflex': 278,
|
||||
'idieresis': 278,
|
||||
'igrave': 278,
|
||||
'j': 278,
|
||||
'k': 556,
|
||||
'l': 278,
|
||||
'less': 584,
|
||||
'logicalnot': 584,
|
||||
'lslash': 278,
|
||||
'm': 889,
|
||||
'macron': 333,
|
||||
'minus': 584,
|
||||
'mu': 611,
|
||||
'multiply': 584,
|
||||
'n': 611,
|
||||
'nine': 556,
|
||||
'ntilde': 611,
|
||||
'numbersign': 556,
|
||||
'o': 611,
|
||||
'oacute': 611,
|
||||
'ocircumflex': 611,
|
||||
'odieresis': 611,
|
||||
'oe': 944,
|
||||
'ogonek': 333,
|
||||
'ograve': 611,
|
||||
'one': 556,
|
||||
'onehalf': 834,
|
||||
'onequarter': 834,
|
||||
'onesuperior': 333,
|
||||
'ordfeminine': 370,
|
||||
'ordmasculine': 365,
|
||||
'oslash': 611,
|
||||
'otilde': 611,
|
||||
'p': 611,
|
||||
'paragraph': 556,
|
||||
'parenleft': 333,
|
||||
'parenright': 333,
|
||||
'percent': 889,
|
||||
'period': 278,
|
||||
'periodcentered': 278,
|
||||
'perthousand': 1000,
|
||||
'plus': 584,
|
||||
'plusminus': 584,
|
||||
'q': 611,
|
||||
'question': 611,
|
||||
'questiondown': 611,
|
||||
'quotedbl': 474,
|
||||
'quotedblbase': 500,
|
||||
'quotedblleft': 500,
|
||||
'quotedblright': 500,
|
||||
'quoteleft': 278,
|
||||
'quoteright': 278,
|
||||
'quotesinglbase': 278,
|
||||
'quotesingle': 238,
|
||||
'r': 389,
|
||||
'registered': 737,
|
||||
'ring': 333,
|
||||
's': 556,
|
||||
'scaron': 556,
|
||||
'section': 556,
|
||||
'semicolon': 333,
|
||||
'seven': 556,
|
||||
'six': 556,
|
||||
'slash': 278,
|
||||
'space': 278,
|
||||
'sterling': 556,
|
||||
't': 333,
|
||||
'thorn': 611,
|
||||
'three': 556,
|
||||
'threequarters': 834,
|
||||
'threesuperior': 333,
|
||||
'tilde': 333,
|
||||
'trademark': 1000,
|
||||
'two': 556,
|
||||
'twosuperior': 333,
|
||||
'u': 611,
|
||||
'uacute': 611,
|
||||
'ucircumflex': 611,
|
||||
'udieresis': 611,
|
||||
'ugrave': 611,
|
||||
'underscore': 556,
|
||||
'v': 556,
|
||||
'w': 778,
|
||||
'x': 556,
|
||||
'y': 556,
|
||||
'yacute': 556,
|
||||
'ydieresis': 556,
|
||||
'yen': 556,
|
||||
'z': 500,
|
||||
'zcaron': 500,
|
||||
'zero': 556}
|
||||
+229
@@ -0,0 +1,229 @@
|
||||
widths = {'A': 667,
|
||||
'AE': 1000,
|
||||
'Aacute': 667,
|
||||
'Acircumflex': 667,
|
||||
'Adieresis': 667,
|
||||
'Agrave': 667,
|
||||
'Aring': 667,
|
||||
'Atilde': 667,
|
||||
'B': 667,
|
||||
'C': 722,
|
||||
'Ccedilla': 722,
|
||||
'D': 722,
|
||||
'E': 667,
|
||||
'Eacute': 667,
|
||||
'Ecircumflex': 667,
|
||||
'Edieresis': 667,
|
||||
'Egrave': 667,
|
||||
'Eth': 722,
|
||||
'Euro': 556,
|
||||
'F': 611,
|
||||
'G': 778,
|
||||
'H': 722,
|
||||
'I': 278,
|
||||
'Iacute': 278,
|
||||
'Icircumflex': 278,
|
||||
'Idieresis': 278,
|
||||
'Igrave': 278,
|
||||
'J': 500,
|
||||
'K': 667,
|
||||
'L': 556,
|
||||
'Lslash': 556,
|
||||
'M': 833,
|
||||
'N': 722,
|
||||
'Ntilde': 722,
|
||||
'O': 778,
|
||||
'OE': 1000,
|
||||
'Oacute': 778,
|
||||
'Ocircumflex': 778,
|
||||
'Odieresis': 778,
|
||||
'Ograve': 778,
|
||||
'Oslash': 778,
|
||||
'Otilde': 778,
|
||||
'P': 667,
|
||||
'Q': 778,
|
||||
'R': 722,
|
||||
'S': 667,
|
||||
'Scaron': 667,
|
||||
'T': 611,
|
||||
'Thorn': 667,
|
||||
'U': 722,
|
||||
'Uacute': 722,
|
||||
'Ucircumflex': 722,
|
||||
'Udieresis': 722,
|
||||
'Ugrave': 722,
|
||||
'V': 667,
|
||||
'W': 944,
|
||||
'X': 667,
|
||||
'Y': 667,
|
||||
'Yacute': 667,
|
||||
'Ydieresis': 667,
|
||||
'Z': 611,
|
||||
'Zcaron': 611,
|
||||
'a': 556,
|
||||
'aacute': 556,
|
||||
'acircumflex': 556,
|
||||
'acute': 333,
|
||||
'adieresis': 556,
|
||||
'ae': 889,
|
||||
'agrave': 556,
|
||||
'ampersand': 667,
|
||||
'aring': 556,
|
||||
'asciicircum': 469,
|
||||
'asciitilde': 584,
|
||||
'asterisk': 389,
|
||||
'at': 1015,
|
||||
'atilde': 556,
|
||||
'b': 556,
|
||||
'backslash': 278,
|
||||
'bar': 260,
|
||||
'braceleft': 334,
|
||||
'braceright': 334,
|
||||
'bracketleft': 278,
|
||||
'bracketright': 278,
|
||||
'breve': 333,
|
||||
'brokenbar': 260,
|
||||
'bullet': 350,
|
||||
'c': 500,
|
||||
'caron': 333,
|
||||
'ccedilla': 500,
|
||||
'cedilla': 333,
|
||||
'cent': 556,
|
||||
'circumflex': 333,
|
||||
'colon': 278,
|
||||
'comma': 278,
|
||||
'copyright': 737,
|
||||
'currency': 556,
|
||||
'd': 556,
|
||||
'dagger': 556,
|
||||
'daggerdbl': 556,
|
||||
'degree': 400,
|
||||
'dieresis': 333,
|
||||
'divide': 584,
|
||||
'dollar': 556,
|
||||
'dotaccent': 333,
|
||||
'dotlessi': 278,
|
||||
'e': 556,
|
||||
'eacute': 556,
|
||||
'ecircumflex': 556,
|
||||
'edieresis': 556,
|
||||
'egrave': 556,
|
||||
'eight': 556,
|
||||
'ellipsis': 1000,
|
||||
'emdash': 1000,
|
||||
'endash': 556,
|
||||
'equal': 584,
|
||||
'eth': 556,
|
||||
'exclam': 278,
|
||||
'exclamdown': 333,
|
||||
'f': 278,
|
||||
'fi': 500,
|
||||
'five': 556,
|
||||
'fl': 500,
|
||||
'florin': 556,
|
||||
'four': 556,
|
||||
'fraction': 167,
|
||||
'g': 556,
|
||||
'germandbls': 611,
|
||||
'grave': 333,
|
||||
'greater': 584,
|
||||
'guillemotleft': 556,
|
||||
'guillemotright': 556,
|
||||
'guilsinglleft': 333,
|
||||
'guilsinglright': 333,
|
||||
'h': 556,
|
||||
'hungarumlaut': 333,
|
||||
'hyphen': 333,
|
||||
'i': 222,
|
||||
'iacute': 278,
|
||||
'icircumflex': 278,
|
||||
'idieresis': 278,
|
||||
'igrave': 278,
|
||||
'j': 222,
|
||||
'k': 500,
|
||||
'l': 222,
|
||||
'less': 584,
|
||||
'logicalnot': 584,
|
||||
'lslash': 222,
|
||||
'm': 833,
|
||||
'macron': 333,
|
||||
'minus': 584,
|
||||
'mu': 556,
|
||||
'multiply': 584,
|
||||
'n': 556,
|
||||
'nine': 556,
|
||||
'ntilde': 556,
|
||||
'numbersign': 556,
|
||||
'o': 556,
|
||||
'oacute': 556,
|
||||
'ocircumflex': 556,
|
||||
'odieresis': 556,
|
||||
'oe': 944,
|
||||
'ogonek': 333,
|
||||
'ograve': 556,
|
||||
'one': 556,
|
||||
'onehalf': 834,
|
||||
'onequarter': 834,
|
||||
'onesuperior': 333,
|
||||
'ordfeminine': 370,
|
||||
'ordmasculine': 365,
|
||||
'oslash': 611,
|
||||
'otilde': 556,
|
||||
'p': 556,
|
||||
'paragraph': 537,
|
||||
'parenleft': 333,
|
||||
'parenright': 333,
|
||||
'percent': 889,
|
||||
'period': 278,
|
||||
'periodcentered': 278,
|
||||
'perthousand': 1000,
|
||||
'plus': 584,
|
||||
'plusminus': 584,
|
||||
'q': 556,
|
||||
'question': 556,
|
||||
'questiondown': 611,
|
||||
'quotedbl': 355,
|
||||
'quotedblbase': 333,
|
||||
'quotedblleft': 333,
|
||||
'quotedblright': 333,
|
||||
'quoteleft': 222,
|
||||
'quoteright': 222,
|
||||
'quotesinglbase': 222,
|
||||
'quotesingle': 191,
|
||||
'r': 333,
|
||||
'registered': 737,
|
||||
'ring': 333,
|
||||
's': 500,
|
||||
'scaron': 500,
|
||||
'section': 556,
|
||||
'semicolon': 278,
|
||||
'seven': 556,
|
||||
'six': 556,
|
||||
'slash': 278,
|
||||
'space': 278,
|
||||
'sterling': 556,
|
||||
't': 278,
|
||||
'thorn': 556,
|
||||
'three': 556,
|
||||
'threequarters': 834,
|
||||
'threesuperior': 333,
|
||||
'tilde': 333,
|
||||
'trademark': 1000,
|
||||
'two': 556,
|
||||
'twosuperior': 333,
|
||||
'u': 556,
|
||||
'uacute': 556,
|
||||
'ucircumflex': 556,
|
||||
'udieresis': 556,
|
||||
'ugrave': 556,
|
||||
'underscore': 556,
|
||||
'v': 500,
|
||||
'w': 722,
|
||||
'x': 500,
|
||||
'y': 500,
|
||||
'yacute': 500,
|
||||
'ydieresis': 500,
|
||||
'yen': 556,
|
||||
'z': 500,
|
||||
'zcaron': 500,
|
||||
'zero': 556}
|
||||
@@ -0,0 +1,190 @@
|
||||
widths = {'Alpha': 722,
|
||||
'Beta': 667,
|
||||
'Chi': 722,
|
||||
'Delta': 612,
|
||||
'Epsilon': 611,
|
||||
'Eta': 722,
|
||||
'Euro': 750,
|
||||
'Gamma': 603,
|
||||
'Ifraktur': 686,
|
||||
'Iota': 333,
|
||||
'Kappa': 722,
|
||||
'Lambda': 686,
|
||||
'Mu': 889,
|
||||
'Nu': 722,
|
||||
'Omega': 768,
|
||||
'Omicron': 722,
|
||||
'Phi': 763,
|
||||
'Pi': 768,
|
||||
'Psi': 795,
|
||||
'Rfraktur': 795,
|
||||
'Rho': 556,
|
||||
'Sigma': 592,
|
||||
'Tau': 611,
|
||||
'Theta': 741,
|
||||
'Upsilon': 690,
|
||||
'Upsilon1': 620,
|
||||
'Xi': 645,
|
||||
'Zeta': 611,
|
||||
'aleph': 823,
|
||||
'alpha': 631,
|
||||
'ampersand': 778,
|
||||
'angle': 768,
|
||||
'angleleft': 329,
|
||||
'angleright': 329,
|
||||
'apple': 790,
|
||||
'approxequal': 549,
|
||||
'arrowboth': 1042,
|
||||
'arrowdblboth': 1042,
|
||||
'arrowdbldown': 603,
|
||||
'arrowdblleft': 987,
|
||||
'arrowdblright': 987,
|
||||
'arrowdblup': 603,
|
||||
'arrowdown': 603,
|
||||
'arrowhorizex': 1000,
|
||||
'arrowleft': 987,
|
||||
'arrowright': 987,
|
||||
'arrowup': 603,
|
||||
'arrowvertex': 603,
|
||||
'asteriskmath': 500,
|
||||
'bar': 200,
|
||||
'beta': 549,
|
||||
'braceex': 494,
|
||||
'braceleft': 480,
|
||||
'braceleftbt': 494,
|
||||
'braceleftmid': 494,
|
||||
'bracelefttp': 494,
|
||||
'braceright': 480,
|
||||
'bracerightbt': 494,
|
||||
'bracerightmid': 494,
|
||||
'bracerighttp': 494,
|
||||
'bracketleft': 333,
|
||||
'bracketleftbt': 384,
|
||||
'bracketleftex': 384,
|
||||
'bracketlefttp': 384,
|
||||
'bracketright': 333,
|
||||
'bracketrightbt': 384,
|
||||
'bracketrightex': 384,
|
||||
'bracketrighttp': 384,
|
||||
'bullet': 460,
|
||||
'carriagereturn': 658,
|
||||
'chi': 549,
|
||||
'circlemultiply': 768,
|
||||
'circleplus': 768,
|
||||
'club': 753,
|
||||
'colon': 278,
|
||||
'comma': 250,
|
||||
'congruent': 549,
|
||||
'copyrightsans': 790,
|
||||
'copyrightserif': 790,
|
||||
'degree': 400,
|
||||
'delta': 494,
|
||||
'diamond': 753,
|
||||
'divide': 549,
|
||||
'dotmath': 250,
|
||||
'eight': 500,
|
||||
'element': 713,
|
||||
'ellipsis': 1000,
|
||||
'emptyset': 823,
|
||||
'epsilon': 439,
|
||||
'equal': 549,
|
||||
'equivalence': 549,
|
||||
'eta': 603,
|
||||
'exclam': 333,
|
||||
'existential': 549,
|
||||
'five': 500,
|
||||
'florin': 500,
|
||||
'four': 500,
|
||||
'fraction': 167,
|
||||
'gamma': 411,
|
||||
'gradient': 713,
|
||||
'greater': 549,
|
||||
'greaterequal': 549,
|
||||
'heart': 753,
|
||||
'infinity': 713,
|
||||
'integral': 274,
|
||||
'integralbt': 686,
|
||||
'integralex': 686,
|
||||
'integraltp': 686,
|
||||
'intersection': 768,
|
||||
'iota': 329,
|
||||
'kappa': 549,
|
||||
'lambda': 549,
|
||||
'less': 549,
|
||||
'lessequal': 549,
|
||||
'logicaland': 603,
|
||||
'logicalnot': 713,
|
||||
'logicalor': 603,
|
||||
'lozenge': 494,
|
||||
'minus': 549,
|
||||
'minute': 247,
|
||||
'mu': 576,
|
||||
'multiply': 549,
|
||||
'nine': 500,
|
||||
'notelement': 713,
|
||||
'notequal': 549,
|
||||
'notsubset': 713,
|
||||
'nu': 521,
|
||||
'numbersign': 500,
|
||||
'omega': 686,
|
||||
'omega1': 713,
|
||||
'omicron': 549,
|
||||
'one': 500,
|
||||
'parenleft': 333,
|
||||
'parenleftbt': 384,
|
||||
'parenleftex': 384,
|
||||
'parenlefttp': 384,
|
||||
'parenright': 333,
|
||||
'parenrightbt': 384,
|
||||
'parenrightex': 384,
|
||||
'parenrighttp': 384,
|
||||
'partialdiff': 494,
|
||||
'percent': 833,
|
||||
'period': 250,
|
||||
'perpendicular': 658,
|
||||
'phi': 521,
|
||||
'phi1': 603,
|
||||
'pi': 549,
|
||||
'plus': 549,
|
||||
'plusminus': 549,
|
||||
'product': 823,
|
||||
'propersubset': 713,
|
||||
'propersuperset': 713,
|
||||
'proportional': 713,
|
||||
'psi': 686,
|
||||
'question': 444,
|
||||
'radical': 549,
|
||||
'radicalex': 500,
|
||||
'reflexsubset': 713,
|
||||
'reflexsuperset': 713,
|
||||
'registersans': 790,
|
||||
'registerserif': 790,
|
||||
'rho': 549,
|
||||
'second': 411,
|
||||
'semicolon': 278,
|
||||
'seven': 500,
|
||||
'sigma': 603,
|
||||
'sigma1': 439,
|
||||
'similar': 549,
|
||||
'six': 500,
|
||||
'slash': 278,
|
||||
'space': 250,
|
||||
'spade': 753,
|
||||
'suchthat': 439,
|
||||
'summation': 713,
|
||||
'tau': 439,
|
||||
'therefore': 863,
|
||||
'theta': 521,
|
||||
'theta1': 631,
|
||||
'three': 500,
|
||||
'trademarksans': 786,
|
||||
'trademarkserif': 890,
|
||||
'two': 500,
|
||||
'underscore': 500,
|
||||
'union': 768,
|
||||
'universal': 713,
|
||||
'upsilon': 576,
|
||||
'weierstrass': 987,
|
||||
'xi': 493,
|
||||
'zero': 500,
|
||||
'zeta': 494}
|
||||
@@ -0,0 +1,229 @@
|
||||
widths = {'A': 722,
|
||||
'AE': 1000,
|
||||
'Aacute': 722,
|
||||
'Acircumflex': 722,
|
||||
'Adieresis': 722,
|
||||
'Agrave': 722,
|
||||
'Aring': 722,
|
||||
'Atilde': 722,
|
||||
'B': 667,
|
||||
'C': 722,
|
||||
'Ccedilla': 722,
|
||||
'D': 722,
|
||||
'E': 667,
|
||||
'Eacute': 667,
|
||||
'Ecircumflex': 667,
|
||||
'Edieresis': 667,
|
||||
'Egrave': 667,
|
||||
'Eth': 722,
|
||||
'Euro': 500,
|
||||
'F': 611,
|
||||
'G': 778,
|
||||
'H': 778,
|
||||
'I': 389,
|
||||
'Iacute': 389,
|
||||
'Icircumflex': 389,
|
||||
'Idieresis': 389,
|
||||
'Igrave': 389,
|
||||
'J': 500,
|
||||
'K': 778,
|
||||
'L': 667,
|
||||
'Lslash': 667,
|
||||
'M': 944,
|
||||
'N': 722,
|
||||
'Ntilde': 722,
|
||||
'O': 778,
|
||||
'OE': 1000,
|
||||
'Oacute': 778,
|
||||
'Ocircumflex': 778,
|
||||
'Odieresis': 778,
|
||||
'Ograve': 778,
|
||||
'Oslash': 778,
|
||||
'Otilde': 778,
|
||||
'P': 611,
|
||||
'Q': 778,
|
||||
'R': 722,
|
||||
'S': 556,
|
||||
'Scaron': 556,
|
||||
'T': 667,
|
||||
'Thorn': 611,
|
||||
'U': 722,
|
||||
'Uacute': 722,
|
||||
'Ucircumflex': 722,
|
||||
'Udieresis': 722,
|
||||
'Ugrave': 722,
|
||||
'V': 722,
|
||||
'W': 1000,
|
||||
'X': 722,
|
||||
'Y': 722,
|
||||
'Yacute': 722,
|
||||
'Ydieresis': 722,
|
||||
'Z': 667,
|
||||
'Zcaron': 667,
|
||||
'a': 500,
|
||||
'aacute': 500,
|
||||
'acircumflex': 500,
|
||||
'acute': 333,
|
||||
'adieresis': 500,
|
||||
'ae': 722,
|
||||
'agrave': 500,
|
||||
'ampersand': 833,
|
||||
'aring': 500,
|
||||
'asciicircum': 581,
|
||||
'asciitilde': 520,
|
||||
'asterisk': 500,
|
||||
'at': 930,
|
||||
'atilde': 500,
|
||||
'b': 556,
|
||||
'backslash': 278,
|
||||
'bar': 220,
|
||||
'braceleft': 394,
|
||||
'braceright': 394,
|
||||
'bracketleft': 333,
|
||||
'bracketright': 333,
|
||||
'breve': 333,
|
||||
'brokenbar': 220,
|
||||
'bullet': 350,
|
||||
'c': 444,
|
||||
'caron': 333,
|
||||
'ccedilla': 444,
|
||||
'cedilla': 333,
|
||||
'cent': 500,
|
||||
'circumflex': 333,
|
||||
'colon': 333,
|
||||
'comma': 250,
|
||||
'copyright': 747,
|
||||
'currency': 500,
|
||||
'd': 556,
|
||||
'dagger': 500,
|
||||
'daggerdbl': 500,
|
||||
'degree': 400,
|
||||
'dieresis': 333,
|
||||
'divide': 570,
|
||||
'dollar': 500,
|
||||
'dotaccent': 333,
|
||||
'dotlessi': 278,
|
||||
'e': 444,
|
||||
'eacute': 444,
|
||||
'ecircumflex': 444,
|
||||
'edieresis': 444,
|
||||
'egrave': 444,
|
||||
'eight': 500,
|
||||
'ellipsis': 1000,
|
||||
'emdash': 1000,
|
||||
'endash': 500,
|
||||
'equal': 570,
|
||||
'eth': 500,
|
||||
'exclam': 333,
|
||||
'exclamdown': 333,
|
||||
'f': 333,
|
||||
'fi': 556,
|
||||
'five': 500,
|
||||
'fl': 556,
|
||||
'florin': 500,
|
||||
'four': 500,
|
||||
'fraction': 167,
|
||||
'g': 500,
|
||||
'germandbls': 556,
|
||||
'grave': 333,
|
||||
'greater': 570,
|
||||
'guillemotleft': 500,
|
||||
'guillemotright': 500,
|
||||
'guilsinglleft': 333,
|
||||
'guilsinglright': 333,
|
||||
'h': 556,
|
||||
'hungarumlaut': 333,
|
||||
'hyphen': 333,
|
||||
'i': 278,
|
||||
'iacute': 278,
|
||||
'icircumflex': 278,
|
||||
'idieresis': 278,
|
||||
'igrave': 278,
|
||||
'j': 333,
|
||||
'k': 556,
|
||||
'l': 278,
|
||||
'less': 570,
|
||||
'logicalnot': 570,
|
||||
'lslash': 278,
|
||||
'm': 833,
|
||||
'macron': 333,
|
||||
'minus': 570,
|
||||
'mu': 556,
|
||||
'multiply': 570,
|
||||
'n': 556,
|
||||
'nine': 500,
|
||||
'ntilde': 556,
|
||||
'numbersign': 500,
|
||||
'o': 500,
|
||||
'oacute': 500,
|
||||
'ocircumflex': 500,
|
||||
'odieresis': 500,
|
||||
'oe': 722,
|
||||
'ogonek': 333,
|
||||
'ograve': 500,
|
||||
'one': 500,
|
||||
'onehalf': 750,
|
||||
'onequarter': 750,
|
||||
'onesuperior': 300,
|
||||
'ordfeminine': 300,
|
||||
'ordmasculine': 330,
|
||||
'oslash': 500,
|
||||
'otilde': 500,
|
||||
'p': 556,
|
||||
'paragraph': 540,
|
||||
'parenleft': 333,
|
||||
'parenright': 333,
|
||||
'percent': 1000,
|
||||
'period': 250,
|
||||
'periodcentered': 250,
|
||||
'perthousand': 1000,
|
||||
'plus': 570,
|
||||
'plusminus': 570,
|
||||
'q': 556,
|
||||
'question': 500,
|
||||
'questiondown': 500,
|
||||
'quotedbl': 555,
|
||||
'quotedblbase': 500,
|
||||
'quotedblleft': 500,
|
||||
'quotedblright': 500,
|
||||
'quoteleft': 333,
|
||||
'quoteright': 333,
|
||||
'quotesinglbase': 333,
|
||||
'quotesingle': 278,
|
||||
'r': 444,
|
||||
'registered': 747,
|
||||
'ring': 333,
|
||||
's': 389,
|
||||
'scaron': 389,
|
||||
'section': 500,
|
||||
'semicolon': 333,
|
||||
'seven': 500,
|
||||
'six': 500,
|
||||
'slash': 278,
|
||||
'space': 250,
|
||||
'sterling': 500,
|
||||
't': 333,
|
||||
'thorn': 556,
|
||||
'three': 500,
|
||||
'threequarters': 750,
|
||||
'threesuperior': 300,
|
||||
'tilde': 333,
|
||||
'trademark': 1000,
|
||||
'two': 500,
|
||||
'twosuperior': 300,
|
||||
'u': 556,
|
||||
'uacute': 556,
|
||||
'ucircumflex': 556,
|
||||
'udieresis': 556,
|
||||
'ugrave': 556,
|
||||
'underscore': 500,
|
||||
'v': 500,
|
||||
'w': 722,
|
||||
'x': 500,
|
||||
'y': 500,
|
||||
'yacute': 500,
|
||||
'ydieresis': 500,
|
||||
'yen': 500,
|
||||
'z': 444,
|
||||
'zcaron': 444,
|
||||
'zero': 500}
|
||||
+229
@@ -0,0 +1,229 @@
|
||||
widths = {'A': 667,
|
||||
'AE': 944,
|
||||
'Aacute': 667,
|
||||
'Acircumflex': 667,
|
||||
'Adieresis': 667,
|
||||
'Agrave': 667,
|
||||
'Aring': 667,
|
||||
'Atilde': 667,
|
||||
'B': 667,
|
||||
'C': 667,
|
||||
'Ccedilla': 667,
|
||||
'D': 722,
|
||||
'E': 667,
|
||||
'Eacute': 667,
|
||||
'Ecircumflex': 667,
|
||||
'Edieresis': 667,
|
||||
'Egrave': 667,
|
||||
'Eth': 722,
|
||||
'Euro': 500,
|
||||
'F': 667,
|
||||
'G': 722,
|
||||
'H': 778,
|
||||
'I': 389,
|
||||
'Iacute': 389,
|
||||
'Icircumflex': 389,
|
||||
'Idieresis': 389,
|
||||
'Igrave': 389,
|
||||
'J': 500,
|
||||
'K': 667,
|
||||
'L': 611,
|
||||
'Lslash': 611,
|
||||
'M': 889,
|
||||
'N': 722,
|
||||
'Ntilde': 722,
|
||||
'O': 722,
|
||||
'OE': 944,
|
||||
'Oacute': 722,
|
||||
'Ocircumflex': 722,
|
||||
'Odieresis': 722,
|
||||
'Ograve': 722,
|
||||
'Oslash': 722,
|
||||
'Otilde': 722,
|
||||
'P': 611,
|
||||
'Q': 722,
|
||||
'R': 667,
|
||||
'S': 556,
|
||||
'Scaron': 556,
|
||||
'T': 611,
|
||||
'Thorn': 611,
|
||||
'U': 722,
|
||||
'Uacute': 722,
|
||||
'Ucircumflex': 722,
|
||||
'Udieresis': 722,
|
||||
'Ugrave': 722,
|
||||
'V': 667,
|
||||
'W': 889,
|
||||
'X': 667,
|
||||
'Y': 611,
|
||||
'Yacute': 611,
|
||||
'Ydieresis': 611,
|
||||
'Z': 611,
|
||||
'Zcaron': 611,
|
||||
'a': 500,
|
||||
'aacute': 500,
|
||||
'acircumflex': 500,
|
||||
'acute': 333,
|
||||
'adieresis': 500,
|
||||
'ae': 722,
|
||||
'agrave': 500,
|
||||
'ampersand': 778,
|
||||
'aring': 500,
|
||||
'asciicircum': 570,
|
||||
'asciitilde': 570,
|
||||
'asterisk': 500,
|
||||
'at': 832,
|
||||
'atilde': 500,
|
||||
'b': 500,
|
||||
'backslash': 278,
|
||||
'bar': 220,
|
||||
'braceleft': 348,
|
||||
'braceright': 348,
|
||||
'bracketleft': 333,
|
||||
'bracketright': 333,
|
||||
'breve': 333,
|
||||
'brokenbar': 220,
|
||||
'bullet': 350,
|
||||
'c': 444,
|
||||
'caron': 333,
|
||||
'ccedilla': 444,
|
||||
'cedilla': 333,
|
||||
'cent': 500,
|
||||
'circumflex': 333,
|
||||
'colon': 333,
|
||||
'comma': 250,
|
||||
'copyright': 747,
|
||||
'currency': 500,
|
||||
'd': 500,
|
||||
'dagger': 500,
|
||||
'daggerdbl': 500,
|
||||
'degree': 400,
|
||||
'dieresis': 333,
|
||||
'divide': 570,
|
||||
'dollar': 500,
|
||||
'dotaccent': 333,
|
||||
'dotlessi': 278,
|
||||
'e': 444,
|
||||
'eacute': 444,
|
||||
'ecircumflex': 444,
|
||||
'edieresis': 444,
|
||||
'egrave': 444,
|
||||
'eight': 500,
|
||||
'ellipsis': 1000,
|
||||
'emdash': 1000,
|
||||
'endash': 500,
|
||||
'equal': 570,
|
||||
'eth': 500,
|
||||
'exclam': 389,
|
||||
'exclamdown': 389,
|
||||
'f': 333,
|
||||
'fi': 556,
|
||||
'five': 500,
|
||||
'fl': 556,
|
||||
'florin': 500,
|
||||
'four': 500,
|
||||
'fraction': 167,
|
||||
'g': 500,
|
||||
'germandbls': 500,
|
||||
'grave': 333,
|
||||
'greater': 570,
|
||||
'guillemotleft': 500,
|
||||
'guillemotright': 500,
|
||||
'guilsinglleft': 333,
|
||||
'guilsinglright': 333,
|
||||
'h': 556,
|
||||
'hungarumlaut': 333,
|
||||
'hyphen': 333,
|
||||
'i': 278,
|
||||
'iacute': 278,
|
||||
'icircumflex': 278,
|
||||
'idieresis': 278,
|
||||
'igrave': 278,
|
||||
'j': 278,
|
||||
'k': 500,
|
||||
'l': 278,
|
||||
'less': 570,
|
||||
'logicalnot': 606,
|
||||
'lslash': 278,
|
||||
'm': 778,
|
||||
'macron': 333,
|
||||
'minus': 606,
|
||||
'mu': 576,
|
||||
'multiply': 570,
|
||||
'n': 556,
|
||||
'nine': 500,
|
||||
'ntilde': 556,
|
||||
'numbersign': 500,
|
||||
'o': 500,
|
||||
'oacute': 500,
|
||||
'ocircumflex': 500,
|
||||
'odieresis': 500,
|
||||
'oe': 722,
|
||||
'ogonek': 333,
|
||||
'ograve': 500,
|
||||
'one': 500,
|
||||
'onehalf': 750,
|
||||
'onequarter': 750,
|
||||
'onesuperior': 300,
|
||||
'ordfeminine': 266,
|
||||
'ordmasculine': 300,
|
||||
'oslash': 500,
|
||||
'otilde': 500,
|
||||
'p': 500,
|
||||
'paragraph': 500,
|
||||
'parenleft': 333,
|
||||
'parenright': 333,
|
||||
'percent': 833,
|
||||
'period': 250,
|
||||
'periodcentered': 250,
|
||||
'perthousand': 1000,
|
||||
'plus': 570,
|
||||
'plusminus': 570,
|
||||
'q': 500,
|
||||
'question': 500,
|
||||
'questiondown': 500,
|
||||
'quotedbl': 555,
|
||||
'quotedblbase': 500,
|
||||
'quotedblleft': 500,
|
||||
'quotedblright': 500,
|
||||
'quoteleft': 333,
|
||||
'quoteright': 333,
|
||||
'quotesinglbase': 333,
|
||||
'quotesingle': 278,
|
||||
'r': 389,
|
||||
'registered': 747,
|
||||
'ring': 333,
|
||||
's': 389,
|
||||
'scaron': 389,
|
||||
'section': 500,
|
||||
'semicolon': 333,
|
||||
'seven': 500,
|
||||
'six': 500,
|
||||
'slash': 278,
|
||||
'space': 250,
|
||||
'sterling': 500,
|
||||
't': 278,
|
||||
'thorn': 500,
|
||||
'three': 500,
|
||||
'threequarters': 750,
|
||||
'threesuperior': 300,
|
||||
'tilde': 333,
|
||||
'trademark': 1000,
|
||||
'two': 500,
|
||||
'twosuperior': 300,
|
||||
'u': 556,
|
||||
'uacute': 556,
|
||||
'ucircumflex': 556,
|
||||
'udieresis': 556,
|
||||
'ugrave': 556,
|
||||
'underscore': 500,
|
||||
'v': 444,
|
||||
'w': 667,
|
||||
'x': 500,
|
||||
'y': 444,
|
||||
'yacute': 444,
|
||||
'ydieresis': 444,
|
||||
'yen': 500,
|
||||
'z': 389,
|
||||
'zcaron': 389,
|
||||
'zero': 500}
|
||||
@@ -0,0 +1,229 @@
|
||||
widths = {'A': 611,
|
||||
'AE': 889,
|
||||
'Aacute': 611,
|
||||
'Acircumflex': 611,
|
||||
'Adieresis': 611,
|
||||
'Agrave': 611,
|
||||
'Aring': 611,
|
||||
'Atilde': 611,
|
||||
'B': 611,
|
||||
'C': 667,
|
||||
'Ccedilla': 667,
|
||||
'D': 722,
|
||||
'E': 611,
|
||||
'Eacute': 611,
|
||||
'Ecircumflex': 611,
|
||||
'Edieresis': 611,
|
||||
'Egrave': 611,
|
||||
'Eth': 722,
|
||||
'Euro': 500,
|
||||
'F': 611,
|
||||
'G': 722,
|
||||
'H': 722,
|
||||
'I': 333,
|
||||
'Iacute': 333,
|
||||
'Icircumflex': 333,
|
||||
'Idieresis': 333,
|
||||
'Igrave': 333,
|
||||
'J': 444,
|
||||
'K': 667,
|
||||
'L': 556,
|
||||
'Lslash': 556,
|
||||
'M': 833,
|
||||
'N': 667,
|
||||
'Ntilde': 667,
|
||||
'O': 722,
|
||||
'OE': 944,
|
||||
'Oacute': 722,
|
||||
'Ocircumflex': 722,
|
||||
'Odieresis': 722,
|
||||
'Ograve': 722,
|
||||
'Oslash': 722,
|
||||
'Otilde': 722,
|
||||
'P': 611,
|
||||
'Q': 722,
|
||||
'R': 611,
|
||||
'S': 500,
|
||||
'Scaron': 500,
|
||||
'T': 556,
|
||||
'Thorn': 611,
|
||||
'U': 722,
|
||||
'Uacute': 722,
|
||||
'Ucircumflex': 722,
|
||||
'Udieresis': 722,
|
||||
'Ugrave': 722,
|
||||
'V': 611,
|
||||
'W': 833,
|
||||
'X': 611,
|
||||
'Y': 556,
|
||||
'Yacute': 556,
|
||||
'Ydieresis': 556,
|
||||
'Z': 556,
|
||||
'Zcaron': 556,
|
||||
'a': 500,
|
||||
'aacute': 500,
|
||||
'acircumflex': 500,
|
||||
'acute': 333,
|
||||
'adieresis': 500,
|
||||
'ae': 667,
|
||||
'agrave': 500,
|
||||
'ampersand': 778,
|
||||
'aring': 500,
|
||||
'asciicircum': 422,
|
||||
'asciitilde': 541,
|
||||
'asterisk': 500,
|
||||
'at': 920,
|
||||
'atilde': 500,
|
||||
'b': 500,
|
||||
'backslash': 278,
|
||||
'bar': 275,
|
||||
'braceleft': 400,
|
||||
'braceright': 400,
|
||||
'bracketleft': 389,
|
||||
'bracketright': 389,
|
||||
'breve': 333,
|
||||
'brokenbar': 275,
|
||||
'bullet': 350,
|
||||
'c': 444,
|
||||
'caron': 333,
|
||||
'ccedilla': 444,
|
||||
'cedilla': 333,
|
||||
'cent': 500,
|
||||
'circumflex': 333,
|
||||
'colon': 333,
|
||||
'comma': 250,
|
||||
'copyright': 760,
|
||||
'currency': 500,
|
||||
'd': 500,
|
||||
'dagger': 500,
|
||||
'daggerdbl': 500,
|
||||
'degree': 400,
|
||||
'dieresis': 333,
|
||||
'divide': 675,
|
||||
'dollar': 500,
|
||||
'dotaccent': 333,
|
||||
'dotlessi': 278,
|
||||
'e': 444,
|
||||
'eacute': 444,
|
||||
'ecircumflex': 444,
|
||||
'edieresis': 444,
|
||||
'egrave': 444,
|
||||
'eight': 500,
|
||||
'ellipsis': 889,
|
||||
'emdash': 889,
|
||||
'endash': 500,
|
||||
'equal': 675,
|
||||
'eth': 500,
|
||||
'exclam': 333,
|
||||
'exclamdown': 389,
|
||||
'f': 278,
|
||||
'fi': 500,
|
||||
'five': 500,
|
||||
'fl': 500,
|
||||
'florin': 500,
|
||||
'four': 500,
|
||||
'fraction': 167,
|
||||
'g': 500,
|
||||
'germandbls': 500,
|
||||
'grave': 333,
|
||||
'greater': 675,
|
||||
'guillemotleft': 500,
|
||||
'guillemotright': 500,
|
||||
'guilsinglleft': 333,
|
||||
'guilsinglright': 333,
|
||||
'h': 500,
|
||||
'hungarumlaut': 333,
|
||||
'hyphen': 333,
|
||||
'i': 278,
|
||||
'iacute': 278,
|
||||
'icircumflex': 278,
|
||||
'idieresis': 278,
|
||||
'igrave': 278,
|
||||
'j': 278,
|
||||
'k': 444,
|
||||
'l': 278,
|
||||
'less': 675,
|
||||
'logicalnot': 675,
|
||||
'lslash': 278,
|
||||
'm': 722,
|
||||
'macron': 333,
|
||||
'minus': 675,
|
||||
'mu': 500,
|
||||
'multiply': 675,
|
||||
'n': 500,
|
||||
'nine': 500,
|
||||
'ntilde': 500,
|
||||
'numbersign': 500,
|
||||
'o': 500,
|
||||
'oacute': 500,
|
||||
'ocircumflex': 500,
|
||||
'odieresis': 500,
|
||||
'oe': 667,
|
||||
'ogonek': 333,
|
||||
'ograve': 500,
|
||||
'one': 500,
|
||||
'onehalf': 750,
|
||||
'onequarter': 750,
|
||||
'onesuperior': 300,
|
||||
'ordfeminine': 276,
|
||||
'ordmasculine': 310,
|
||||
'oslash': 500,
|
||||
'otilde': 500,
|
||||
'p': 500,
|
||||
'paragraph': 523,
|
||||
'parenleft': 333,
|
||||
'parenright': 333,
|
||||
'percent': 833,
|
||||
'period': 250,
|
||||
'periodcentered': 250,
|
||||
'perthousand': 1000,
|
||||
'plus': 675,
|
||||
'plusminus': 675,
|
||||
'q': 500,
|
||||
'question': 500,
|
||||
'questiondown': 500,
|
||||
'quotedbl': 420,
|
||||
'quotedblbase': 556,
|
||||
'quotedblleft': 556,
|
||||
'quotedblright': 556,
|
||||
'quoteleft': 333,
|
||||
'quoteright': 333,
|
||||
'quotesinglbase': 333,
|
||||
'quotesingle': 214,
|
||||
'r': 389,
|
||||
'registered': 760,
|
||||
'ring': 333,
|
||||
's': 389,
|
||||
'scaron': 389,
|
||||
'section': 500,
|
||||
'semicolon': 333,
|
||||
'seven': 500,
|
||||
'six': 500,
|
||||
'slash': 278,
|
||||
'space': 250,
|
||||
'sterling': 500,
|
||||
't': 278,
|
||||
'thorn': 500,
|
||||
'three': 500,
|
||||
'threequarters': 750,
|
||||
'threesuperior': 300,
|
||||
'tilde': 333,
|
||||
'trademark': 980,
|
||||
'two': 500,
|
||||
'twosuperior': 300,
|
||||
'u': 500,
|
||||
'uacute': 500,
|
||||
'ucircumflex': 500,
|
||||
'udieresis': 500,
|
||||
'ugrave': 500,
|
||||
'underscore': 500,
|
||||
'v': 444,
|
||||
'w': 667,
|
||||
'x': 444,
|
||||
'y': 444,
|
||||
'yacute': 444,
|
||||
'ydieresis': 444,
|
||||
'yen': 500,
|
||||
'z': 389,
|
||||
'zcaron': 389,
|
||||
'zero': 500}
|
||||
@@ -0,0 +1,229 @@
|
||||
widths = {'A': 722,
|
||||
'AE': 889,
|
||||
'Aacute': 722,
|
||||
'Acircumflex': 722,
|
||||
'Adieresis': 722,
|
||||
'Agrave': 722,
|
||||
'Aring': 722,
|
||||
'Atilde': 722,
|
||||
'B': 667,
|
||||
'C': 667,
|
||||
'Ccedilla': 667,
|
||||
'D': 722,
|
||||
'E': 611,
|
||||
'Eacute': 611,
|
||||
'Ecircumflex': 611,
|
||||
'Edieresis': 611,
|
||||
'Egrave': 611,
|
||||
'Eth': 722,
|
||||
'Euro': 500,
|
||||
'F': 556,
|
||||
'G': 722,
|
||||
'H': 722,
|
||||
'I': 333,
|
||||
'Iacute': 333,
|
||||
'Icircumflex': 333,
|
||||
'Idieresis': 333,
|
||||
'Igrave': 333,
|
||||
'J': 389,
|
||||
'K': 722,
|
||||
'L': 611,
|
||||
'Lslash': 611,
|
||||
'M': 889,
|
||||
'N': 722,
|
||||
'Ntilde': 722,
|
||||
'O': 722,
|
||||
'OE': 889,
|
||||
'Oacute': 722,
|
||||
'Ocircumflex': 722,
|
||||
'Odieresis': 722,
|
||||
'Ograve': 722,
|
||||
'Oslash': 722,
|
||||
'Otilde': 722,
|
||||
'P': 556,
|
||||
'Q': 722,
|
||||
'R': 667,
|
||||
'S': 556,
|
||||
'Scaron': 556,
|
||||
'T': 611,
|
||||
'Thorn': 556,
|
||||
'U': 722,
|
||||
'Uacute': 722,
|
||||
'Ucircumflex': 722,
|
||||
'Udieresis': 722,
|
||||
'Ugrave': 722,
|
||||
'V': 722,
|
||||
'W': 944,
|
||||
'X': 722,
|
||||
'Y': 722,
|
||||
'Yacute': 722,
|
||||
'Ydieresis': 722,
|
||||
'Z': 611,
|
||||
'Zcaron': 611,
|
||||
'a': 444,
|
||||
'aacute': 444,
|
||||
'acircumflex': 444,
|
||||
'acute': 333,
|
||||
'adieresis': 444,
|
||||
'ae': 667,
|
||||
'agrave': 444,
|
||||
'ampersand': 778,
|
||||
'aring': 444,
|
||||
'asciicircum': 469,
|
||||
'asciitilde': 541,
|
||||
'asterisk': 500,
|
||||
'at': 921,
|
||||
'atilde': 444,
|
||||
'b': 500,
|
||||
'backslash': 278,
|
||||
'bar': 200,
|
||||
'braceleft': 480,
|
||||
'braceright': 480,
|
||||
'bracketleft': 333,
|
||||
'bracketright': 333,
|
||||
'breve': 333,
|
||||
'brokenbar': 200,
|
||||
'bullet': 350,
|
||||
'c': 444,
|
||||
'caron': 333,
|
||||
'ccedilla': 444,
|
||||
'cedilla': 333,
|
||||
'cent': 500,
|
||||
'circumflex': 333,
|
||||
'colon': 278,
|
||||
'comma': 250,
|
||||
'copyright': 760,
|
||||
'currency': 500,
|
||||
'd': 500,
|
||||
'dagger': 500,
|
||||
'daggerdbl': 500,
|
||||
'degree': 400,
|
||||
'dieresis': 333,
|
||||
'divide': 564,
|
||||
'dollar': 500,
|
||||
'dotaccent': 333,
|
||||
'dotlessi': 278,
|
||||
'e': 444,
|
||||
'eacute': 444,
|
||||
'ecircumflex': 444,
|
||||
'edieresis': 444,
|
||||
'egrave': 444,
|
||||
'eight': 500,
|
||||
'ellipsis': 1000,
|
||||
'emdash': 1000,
|
||||
'endash': 500,
|
||||
'equal': 564,
|
||||
'eth': 500,
|
||||
'exclam': 333,
|
||||
'exclamdown': 333,
|
||||
'f': 333,
|
||||
'fi': 556,
|
||||
'five': 500,
|
||||
'fl': 556,
|
||||
'florin': 500,
|
||||
'four': 500,
|
||||
'fraction': 167,
|
||||
'g': 500,
|
||||
'germandbls': 500,
|
||||
'grave': 333,
|
||||
'greater': 564,
|
||||
'guillemotleft': 500,
|
||||
'guillemotright': 500,
|
||||
'guilsinglleft': 333,
|
||||
'guilsinglright': 333,
|
||||
'h': 500,
|
||||
'hungarumlaut': 333,
|
||||
'hyphen': 333,
|
||||
'i': 278,
|
||||
'iacute': 278,
|
||||
'icircumflex': 278,
|
||||
'idieresis': 278,
|
||||
'igrave': 278,
|
||||
'j': 278,
|
||||
'k': 500,
|
||||
'l': 278,
|
||||
'less': 564,
|
||||
'logicalnot': 564,
|
||||
'lslash': 278,
|
||||
'm': 778,
|
||||
'macron': 333,
|
||||
'minus': 564,
|
||||
'mu': 500,
|
||||
'multiply': 564,
|
||||
'n': 500,
|
||||
'nine': 500,
|
||||
'ntilde': 500,
|
||||
'numbersign': 500,
|
||||
'o': 500,
|
||||
'oacute': 500,
|
||||
'ocircumflex': 500,
|
||||
'odieresis': 500,
|
||||
'oe': 722,
|
||||
'ogonek': 333,
|
||||
'ograve': 500,
|
||||
'one': 500,
|
||||
'onehalf': 750,
|
||||
'onequarter': 750,
|
||||
'onesuperior': 300,
|
||||
'ordfeminine': 276,
|
||||
'ordmasculine': 310,
|
||||
'oslash': 500,
|
||||
'otilde': 500,
|
||||
'p': 500,
|
||||
'paragraph': 453,
|
||||
'parenleft': 333,
|
||||
'parenright': 333,
|
||||
'percent': 833,
|
||||
'period': 250,
|
||||
'periodcentered': 250,
|
||||
'perthousand': 1000,
|
||||
'plus': 564,
|
||||
'plusminus': 564,
|
||||
'q': 500,
|
||||
'question': 444,
|
||||
'questiondown': 444,
|
||||
'quotedbl': 408,
|
||||
'quotedblbase': 444,
|
||||
'quotedblleft': 444,
|
||||
'quotedblright': 444,
|
||||
'quoteleft': 333,
|
||||
'quoteright': 333,
|
||||
'quotesinglbase': 333,
|
||||
'quotesingle': 180,
|
||||
'r': 333,
|
||||
'registered': 760,
|
||||
'ring': 333,
|
||||
's': 389,
|
||||
'scaron': 389,
|
||||
'section': 500,
|
||||
'semicolon': 278,
|
||||
'seven': 500,
|
||||
'six': 500,
|
||||
'slash': 278,
|
||||
'space': 250,
|
||||
'sterling': 500,
|
||||
't': 278,
|
||||
'thorn': 500,
|
||||
'three': 500,
|
||||
'threequarters': 750,
|
||||
'threesuperior': 300,
|
||||
'tilde': 333,
|
||||
'trademark': 980,
|
||||
'two': 500,
|
||||
'twosuperior': 300,
|
||||
'u': 500,
|
||||
'uacute': 500,
|
||||
'ucircumflex': 500,
|
||||
'udieresis': 500,
|
||||
'ugrave': 500,
|
||||
'underscore': 500,
|
||||
'v': 500,
|
||||
'w': 722,
|
||||
'x': 500,
|
||||
'y': 500,
|
||||
'yacute': 500,
|
||||
'ydieresis': 500,
|
||||
'yen': 500,
|
||||
'z': 444,
|
||||
'zcaron': 444,
|
||||
'zero': 500}
|
||||
@@ -0,0 +1,202 @@
|
||||
widths = {'a1': 974,
|
||||
'a10': 692,
|
||||
'a100': 668,
|
||||
'a101': 732,
|
||||
'a102': 544,
|
||||
'a103': 544,
|
||||
'a104': 910,
|
||||
'a105': 911,
|
||||
'a106': 667,
|
||||
'a107': 760,
|
||||
'a108': 760,
|
||||
'a109': 626,
|
||||
'a11': 960,
|
||||
'a110': 694,
|
||||
'a111': 595,
|
||||
'a112': 776,
|
||||
'a117': 690,
|
||||
'a118': 791,
|
||||
'a119': 790,
|
||||
'a12': 939,
|
||||
'a120': 788,
|
||||
'a121': 788,
|
||||
'a122': 788,
|
||||
'a123': 788,
|
||||
'a124': 788,
|
||||
'a125': 788,
|
||||
'a126': 788,
|
||||
'a127': 788,
|
||||
'a128': 788,
|
||||
'a129': 788,
|
||||
'a13': 549,
|
||||
'a130': 788,
|
||||
'a131': 788,
|
||||
'a132': 788,
|
||||
'a133': 788,
|
||||
'a134': 788,
|
||||
'a135': 788,
|
||||
'a136': 788,
|
||||
'a137': 788,
|
||||
'a138': 788,
|
||||
'a139': 788,
|
||||
'a14': 855,
|
||||
'a140': 788,
|
||||
'a141': 788,
|
||||
'a142': 788,
|
||||
'a143': 788,
|
||||
'a144': 788,
|
||||
'a145': 788,
|
||||
'a146': 788,
|
||||
'a147': 788,
|
||||
'a148': 788,
|
||||
'a149': 788,
|
||||
'a15': 911,
|
||||
'a150': 788,
|
||||
'a151': 788,
|
||||
'a152': 788,
|
||||
'a153': 788,
|
||||
'a154': 788,
|
||||
'a155': 788,
|
||||
'a156': 788,
|
||||
'a157': 788,
|
||||
'a158': 788,
|
||||
'a159': 788,
|
||||
'a16': 933,
|
||||
'a160': 894,
|
||||
'a161': 838,
|
||||
'a162': 924,
|
||||
'a163': 1016,
|
||||
'a164': 458,
|
||||
'a165': 924,
|
||||
'a166': 918,
|
||||
'a167': 927,
|
||||
'a168': 928,
|
||||
'a169': 928,
|
||||
'a17': 945,
|
||||
'a170': 834,
|
||||
'a171': 873,
|
||||
'a172': 828,
|
||||
'a173': 924,
|
||||
'a174': 917,
|
||||
'a175': 930,
|
||||
'a176': 931,
|
||||
'a177': 463,
|
||||
'a178': 883,
|
||||
'a179': 836,
|
||||
'a18': 974,
|
||||
'a180': 867,
|
||||
'a181': 696,
|
||||
'a182': 874,
|
||||
'a183': 760,
|
||||
'a184': 946,
|
||||
'a185': 865,
|
||||
'a186': 967,
|
||||
'a187': 831,
|
||||
'a188': 873,
|
||||
'a189': 927,
|
||||
'a19': 755,
|
||||
'a190': 970,
|
||||
'a191': 918,
|
||||
'a192': 748,
|
||||
'a193': 836,
|
||||
'a194': 771,
|
||||
'a195': 888,
|
||||
'a196': 748,
|
||||
'a197': 771,
|
||||
'a198': 888,
|
||||
'a199': 867,
|
||||
'a2': 961,
|
||||
'a20': 846,
|
||||
'a200': 696,
|
||||
'a201': 874,
|
||||
'a202': 974,
|
||||
'a203': 762,
|
||||
'a204': 759,
|
||||
'a205': 509,
|
||||
'a206': 410,
|
||||
'a21': 762,
|
||||
'a22': 761,
|
||||
'a23': 571,
|
||||
'a24': 677,
|
||||
'a25': 763,
|
||||
'a26': 760,
|
||||
'a27': 759,
|
||||
'a28': 754,
|
||||
'a29': 786,
|
||||
'a3': 980,
|
||||
'a30': 788,
|
||||
'a31': 788,
|
||||
'a32': 790,
|
||||
'a33': 793,
|
||||
'a34': 794,
|
||||
'a35': 816,
|
||||
'a36': 823,
|
||||
'a37': 789,
|
||||
'a38': 841,
|
||||
'a39': 823,
|
||||
'a4': 719,
|
||||
'a40': 833,
|
||||
'a41': 816,
|
||||
'a42': 831,
|
||||
'a43': 923,
|
||||
'a44': 744,
|
||||
'a45': 723,
|
||||
'a46': 749,
|
||||
'a47': 790,
|
||||
'a48': 792,
|
||||
'a49': 695,
|
||||
'a5': 789,
|
||||
'a50': 776,
|
||||
'a51': 768,
|
||||
'a52': 792,
|
||||
'a53': 759,
|
||||
'a54': 707,
|
||||
'a55': 708,
|
||||
'a56': 682,
|
||||
'a57': 701,
|
||||
'a58': 826,
|
||||
'a59': 815,
|
||||
'a6': 494,
|
||||
'a60': 789,
|
||||
'a61': 789,
|
||||
'a62': 707,
|
||||
'a63': 687,
|
||||
'a64': 696,
|
||||
'a65': 689,
|
||||
'a66': 786,
|
||||
'a67': 787,
|
||||
'a68': 713,
|
||||
'a69': 791,
|
||||
'a7': 552,
|
||||
'a70': 785,
|
||||
'a71': 791,
|
||||
'a72': 873,
|
||||
'a73': 761,
|
||||
'a74': 762,
|
||||
'a75': 759,
|
||||
'a76': 892,
|
||||
'a77': 892,
|
||||
'a78': 788,
|
||||
'a79': 784,
|
||||
'a8': 537,
|
||||
'a81': 438,
|
||||
'a82': 138,
|
||||
'a83': 277,
|
||||
'a84': 415,
|
||||
'a85': 509,
|
||||
'a86': 410,
|
||||
'a87': 234,
|
||||
'a88': 234,
|
||||
'a89': 390,
|
||||
'a9': 577,
|
||||
'a90': 390,
|
||||
'a91': 276,
|
||||
'a92': 276,
|
||||
'a93': 317,
|
||||
'a94': 317,
|
||||
'a95': 334,
|
||||
'a96': 334,
|
||||
'a97': 392,
|
||||
'a98': 392,
|
||||
'a99': 668,
|
||||
'space': 278}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,516 @@
|
||||
#Copyright ReportLab Europe Ltd. 2000-2017
|
||||
#see license.txt for license details
|
||||
#history https://hg.reportlab.com/hg-public/reportlab/log/tip/src/reportlab/pdfbase/cidfonts.py
|
||||
#$Header $
|
||||
__version__='3.3.0'
|
||||
__doc__="""CID (Asian multi-byte) font support.
|
||||
|
||||
This defines classes to represent CID fonts. They know how to calculate
|
||||
their own width and how to write themselves into PDF files."""
|
||||
|
||||
import os
|
||||
import marshal
|
||||
import time
|
||||
from hashlib import md5
|
||||
|
||||
from reportlab.pdfbase import pdfmetrics
|
||||
from reportlab.pdfbase._cidfontdata import allowedTypeFaces, allowedEncodings, CIDFontInfo, \
|
||||
defaultUnicodeEncodings, widthsByUnichar
|
||||
from reportlab.pdfgen.canvas import Canvas
|
||||
from reportlab.pdfbase import pdfdoc
|
||||
from reportlab.lib.rl_accel import escapePDF
|
||||
from reportlab.rl_config import CMapSearchPath
|
||||
from reportlab.lib.utils import isSeq, isBytes
|
||||
|
||||
#quick hackery for 2.0 release. Now we always do unicode, and have built in
|
||||
#the CMAP data, any code to load CMap files is not needed.
|
||||
DISABLE_CMAP = True
|
||||
|
||||
|
||||
def findCMapFile(name):
|
||||
"Returns full filename, or raises error"
|
||||
for dirname in CMapSearchPath:
|
||||
cmapfile = dirname + os.sep + name
|
||||
if os.path.isfile(cmapfile):
|
||||
#print "found", cmapfile
|
||||
return cmapfile
|
||||
raise IOError('CMAP file for encodings "%s" not found!' % name)
|
||||
|
||||
def structToPDF(structure):
|
||||
"Converts deeply nested structure to PDFdoc dictionary/array objects"
|
||||
if isinstance(structure,dict):
|
||||
newDict = {}
|
||||
for k, v in structure.items():
|
||||
newDict[k] = structToPDF(v)
|
||||
return pdfdoc.PDFDictionary(newDict)
|
||||
elif isSeq(structure):
|
||||
newList = []
|
||||
for elem in structure:
|
||||
newList.append(structToPDF(elem))
|
||||
return pdfdoc.PDFArray(newList)
|
||||
else:
|
||||
return structure
|
||||
|
||||
class CIDEncoding(pdfmetrics.Encoding):
|
||||
"""Multi-byte encoding. These are loaded from CMAP files.
|
||||
|
||||
A CMAP file is like a mini-codec. It defines the correspondence
|
||||
between code points in the (multi-byte) input data and Character
|
||||
IDs. """
|
||||
# aims to do similar things to Brian Hooper's CMap class,
|
||||
# but I could not get it working and had to rewrite.
|
||||
# also, we should really rearrange our current encoding
|
||||
# into a SingleByteEncoding since many of its methods
|
||||
# should not apply here.
|
||||
|
||||
def __init__(self, name, useCache=1):
|
||||
self.name = name
|
||||
self._mapFileHash = None
|
||||
self._codeSpaceRanges = []
|
||||
self._notDefRanges = []
|
||||
self._cmap = {}
|
||||
self.source = None
|
||||
if not DISABLE_CMAP:
|
||||
if useCache:
|
||||
from reportlab.lib.utils import get_rl_tempdir
|
||||
fontmapdir = get_rl_tempdir('FastCMAPS')
|
||||
if os.path.isfile(fontmapdir + os.sep + name + '.fastmap'):
|
||||
self.fastLoad(fontmapdir)
|
||||
self.source = fontmapdir + os.sep + name + '.fastmap'
|
||||
else:
|
||||
self.parseCMAPFile(name)
|
||||
self.source = 'CMAP: ' + name
|
||||
self.fastSave(fontmapdir)
|
||||
else:
|
||||
self.parseCMAPFile(name)
|
||||
|
||||
def _hash(self, text):
|
||||
hasher = md5(usedforsecurity=False)
|
||||
hasher.update(text)
|
||||
return hasher.digest()
|
||||
|
||||
def parseCMAPFile(self, name):
|
||||
"""This is a tricky one as CMAP files are Postscript
|
||||
ones. Some refer to others with a 'usecmap'
|
||||
command"""
|
||||
#started = time.clock()
|
||||
cmapfile = findCMapFile(name)
|
||||
# this will CRAWL with the unicode encodings...
|
||||
rawdata = open(cmapfile, 'r').read()
|
||||
|
||||
self._mapFileHash = self._hash(rawdata)
|
||||
#if it contains the token 'usecmap', parse the other
|
||||
#cmap file first....
|
||||
usecmap_pos = rawdata.find('usecmap')
|
||||
if usecmap_pos > -1:
|
||||
#they tell us to look in another file
|
||||
#for the code space ranges. The one
|
||||
# to use will be the previous word.
|
||||
chunk = rawdata[0:usecmap_pos]
|
||||
words = chunk.split()
|
||||
otherCMAPName = words[-1]
|
||||
#print 'referred to another CMAP %s' % otherCMAPName
|
||||
self.parseCMAPFile(otherCMAPName)
|
||||
# now continue parsing this, as it may
|
||||
# override some settings
|
||||
|
||||
|
||||
words = rawdata.split()
|
||||
while words != []:
|
||||
if words[0] == 'begincodespacerange':
|
||||
words = words[1:]
|
||||
while words[0] != 'endcodespacerange':
|
||||
strStart, strEnd, words = words[0], words[1], words[2:]
|
||||
start = int(strStart[1:-1], 16)
|
||||
end = int(strEnd[1:-1], 16)
|
||||
self._codeSpaceRanges.append((start, end),)
|
||||
elif words[0] == 'beginnotdefrange':
|
||||
words = words[1:]
|
||||
while words[0] != 'endnotdefrange':
|
||||
strStart, strEnd, strValue = words[0:3]
|
||||
start = int(strStart[1:-1], 16)
|
||||
end = int(strEnd[1:-1], 16)
|
||||
value = int(strValue)
|
||||
self._notDefRanges.append((start, end, value),)
|
||||
words = words[3:]
|
||||
elif words[0] == 'begincidrange':
|
||||
words = words[1:]
|
||||
while words[0] != 'endcidrange':
|
||||
strStart, strEnd, strValue = words[0:3]
|
||||
start = int(strStart[1:-1], 16)
|
||||
end = int(strEnd[1:-1], 16)
|
||||
value = int(strValue)
|
||||
# this means that 'start' corresponds to 'value',
|
||||
# start+1 corresponds to value+1 and so on up
|
||||
# to end
|
||||
offset = 0
|
||||
while start + offset <= end:
|
||||
self._cmap[start + offset] = value + offset
|
||||
offset = offset + 1
|
||||
words = words[3:]
|
||||
|
||||
else:
|
||||
words = words[1:]
|
||||
#finished = time.clock()
|
||||
#print 'parsed CMAP %s in %0.4f seconds' % (self.name, finished - started)
|
||||
|
||||
def translate(self, text):
|
||||
"Convert a string into a list of CIDs"
|
||||
output = []
|
||||
cmap = self._cmap
|
||||
lastChar = ''
|
||||
for char in text:
|
||||
if lastChar != '':
|
||||
#print 'convert character pair "%s"' % (lastChar + char)
|
||||
num = ord(lastChar) * 256 + ord(char)
|
||||
else:
|
||||
#print 'convert character "%s"' % char
|
||||
num = ord(char)
|
||||
lastChar = char
|
||||
found = 0
|
||||
for low, high in self._codeSpaceRanges:
|
||||
if low < num < high:
|
||||
try:
|
||||
cid = cmap[num]
|
||||
#print '%d -> %d' % (num, cid)
|
||||
except KeyError:
|
||||
#not defined. Try to find the appropriate
|
||||
# notdef character, or failing that return
|
||||
# zero
|
||||
cid = 0
|
||||
for low2, high2, notdef in self._notDefRanges:
|
||||
if low2 < num < high2:
|
||||
cid = notdef
|
||||
break
|
||||
output.append(cid)
|
||||
found = 1
|
||||
break
|
||||
if found:
|
||||
lastChar = ''
|
||||
else:
|
||||
lastChar = char
|
||||
return output
|
||||
|
||||
def fastSave(self, directory):
|
||||
f = open(os.path.join(directory, self.name + '.fastmap'), 'wb')
|
||||
marshal.dump(self._mapFileHash, f)
|
||||
marshal.dump(self._codeSpaceRanges, f)
|
||||
marshal.dump(self._notDefRanges, f)
|
||||
marshal.dump(self._cmap, f)
|
||||
f.close()
|
||||
|
||||
def fastLoad(self, directory):
|
||||
started = time.clock()
|
||||
f = open(os.path.join(directory, self.name + '.fastmap'), 'rb')
|
||||
self._mapFileHash = marshal.load(f)
|
||||
self._codeSpaceRanges = marshal.load(f)
|
||||
self._notDefRanges = marshal.load(f)
|
||||
self._cmap = marshal.load(f)
|
||||
f.close()
|
||||
finished = time.clock()
|
||||
#print 'loaded %s in %0.4f seconds' % (self.name, finished - started)
|
||||
|
||||
def getData(self):
|
||||
"""Simple persistence helper. Return a dict with all that matters."""
|
||||
return {
|
||||
'mapFileHash': self._mapFileHash,
|
||||
'codeSpaceRanges': self._codeSpaceRanges,
|
||||
'notDefRanges': self._notDefRanges,
|
||||
'cmap': self._cmap,
|
||||
}
|
||||
|
||||
class CIDTypeFace(pdfmetrics.TypeFace):
|
||||
"""Multi-byte type face.
|
||||
|
||||
Conceptually similar to a single byte typeface,
|
||||
but the glyphs are identified by a numeric Character
|
||||
ID (CID) and not a glyph name. """
|
||||
def __init__(self, name):
|
||||
"""Initialised from one of the canned dictionaries in allowedEncodings
|
||||
|
||||
Or rather, it will be shortly..."""
|
||||
pdfmetrics.TypeFace.__init__(self, name)
|
||||
self._extractDictInfo(name)
|
||||
def _extractDictInfo(self, name):
|
||||
try:
|
||||
fontDict = CIDFontInfo[name]
|
||||
except KeyError:
|
||||
raise KeyError("Unable to find information on CID typeface '%s'" % name +
|
||||
"Only the following font names work:" + repr(allowedTypeFaces))
|
||||
descFont = fontDict['DescendantFonts'][0]
|
||||
self.ascent = descFont['FontDescriptor']['Ascent']
|
||||
self.descent = descFont['FontDescriptor']['Descent']
|
||||
self._defaultWidth = descFont['DW']
|
||||
self._explicitWidths = self._expandWidths(descFont['W'])
|
||||
|
||||
# should really support self.glyphWidths, self.glyphNames
|
||||
# but not done yet.
|
||||
|
||||
|
||||
def _expandWidths(self, compactWidthArray):
|
||||
"""Expands Adobe nested list structure to get a dictionary of widths.
|
||||
|
||||
Here is an example of such a structure.::
|
||||
|
||||
(
|
||||
# starting at character ID 1, next n characters have the widths given.
|
||||
1, (277,305,500,668,668,906,727,305,445,445,508,668,305,379,305,539),
|
||||
# all Characters from ID 17 to 26 are 668 em units wide
|
||||
17, 26, 668,
|
||||
27, (305, 305, 668, 668, 668, 566, 871, 727, 637, 652, 699, 574, 555,
|
||||
676, 687, 242, 492, 664, 582, 789, 707, 734, 582, 734, 605, 605,
|
||||
641, 668, 727, 945, 609, 609, 574, 445, 668, 445, 668, 668, 590,
|
||||
555, 609, 547, 602, 574, 391, 609, 582, 234, 277, 539, 234, 895,
|
||||
582, 605, 602, 602, 387, 508, 441, 582, 562, 781, 531, 570, 555,
|
||||
449, 246, 449, 668),
|
||||
# these must be half width katakana and the like.
|
||||
231, 632, 500
|
||||
)
|
||||
|
||||
"""
|
||||
data = compactWidthArray[:]
|
||||
widths = {}
|
||||
while data:
|
||||
start, data = data[0], data[1:]
|
||||
if isSeq(data[0]):
|
||||
items, data = data[0], data[1:]
|
||||
for offset in range(len(items)):
|
||||
widths[start + offset] = items[offset]
|
||||
else:
|
||||
end, width, data = data[0], data[1], data[2:]
|
||||
for idx in range(start, end+1):
|
||||
widths[idx] = width
|
||||
return widths
|
||||
|
||||
def getCharWidth(self, characterId):
|
||||
return self._explicitWidths.get(characterId, self._defaultWidth)
|
||||
|
||||
class CIDFont(pdfmetrics.Font):
|
||||
"Represents a built-in multi-byte font"
|
||||
_multiByte = 1
|
||||
|
||||
def __init__(self, face, encoding):
|
||||
|
||||
assert face in allowedTypeFaces, "TypeFace '%s' not supported! Use any of these instead: %s" % (face, allowedTypeFaces)
|
||||
self.faceName = face
|
||||
#should cache in registry...
|
||||
self.face = CIDTypeFace(face)
|
||||
|
||||
assert encoding in allowedEncodings, "Encoding '%s' not supported! Use any of these instead: %s" % (encoding, allowedEncodings)
|
||||
self.encodingName = encoding
|
||||
self.encoding = CIDEncoding(encoding)
|
||||
|
||||
#legacy hack doing quick cut and paste.
|
||||
self.fontName = self.faceName + '-' + self.encodingName
|
||||
self.name = self.fontName
|
||||
|
||||
# need to know if it is vertical or horizontal
|
||||
self.isVertical = (self.encodingName[-1] == 'V')
|
||||
|
||||
#no substitutes initially
|
||||
self.substitutionFonts = []
|
||||
|
||||
def formatForPdf(self, text):
|
||||
encoded = escapePDF(text)
|
||||
#print 'encoded CIDFont:', encoded
|
||||
return encoded
|
||||
|
||||
def stringWidth(self, text, size, encoding=None):
|
||||
"""This presumes non-Unicode input. UnicodeCIDFont wraps it for that context"""
|
||||
cidlist = self.encoding.translate(text)
|
||||
if self.isVertical:
|
||||
#this part is "not checked!" but seems to work.
|
||||
#assume each is 1000 ems high
|
||||
return len(cidlist) * size
|
||||
else:
|
||||
w = 0
|
||||
for cid in cidlist:
|
||||
w = w + self.face.getCharWidth(cid)
|
||||
return 0.001 * w * size
|
||||
|
||||
|
||||
def addObjects(self, doc):
|
||||
"""The explicit code in addMinchoObjects and addGothicObjects
|
||||
will be replaced by something that pulls the data from
|
||||
_cidfontdata.py in the next few days."""
|
||||
internalName = 'F' + repr(len(doc.fontMapping)+1)
|
||||
|
||||
bigDict = CIDFontInfo[self.face.name]
|
||||
bigDict['Name'] = '/' + internalName
|
||||
bigDict['Encoding'] = '/' + self.encodingName
|
||||
|
||||
#convert to PDF dictionary/array objects
|
||||
cidObj = structToPDF(bigDict)
|
||||
|
||||
# link into document, and add to font map
|
||||
r = doc.Reference(cidObj, internalName)
|
||||
fontDict = doc.idToObject['BasicFonts'].dict
|
||||
fontDict[internalName] = r
|
||||
doc.fontMapping[self.name] = '/' + internalName
|
||||
|
||||
|
||||
class UnicodeCIDFont(CIDFont):
|
||||
"""Wraps up CIDFont to hide explicit encoding choice;
|
||||
encodes text for output as UTF16.
|
||||
|
||||
lang should be one of 'jpn',chs','cht','kor' for now.
|
||||
if vertical is set, it will select a different widths array
|
||||
and possibly glyphs for some punctuation marks.
|
||||
|
||||
halfWidth is only for Japanese.
|
||||
|
||||
|
||||
>>> dodgy = UnicodeCIDFont('nonexistent')
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
KeyError: "don't know anything about CID font nonexistent"
|
||||
>>> heisei = UnicodeCIDFont('HeiseiMin-W3')
|
||||
>>> heisei.name
|
||||
'HeiseiMin-W3'
|
||||
>>> heisei.language
|
||||
'jpn'
|
||||
>>> heisei.encoding.name
|
||||
'UniJIS-UCS2-H'
|
||||
>>> #This is how PDF data gets encoded.
|
||||
>>> print(heisei.formatForPdf('hello'))
|
||||
\\000h\\000e\\000l\\000l\\000o
|
||||
>>> tokyo = u'\u6771\u4AEC'
|
||||
>>> print(heisei.formatForPdf(tokyo))
|
||||
gqJ\\354
|
||||
>>> print(heisei.stringWidth(tokyo,10))
|
||||
20.0
|
||||
>>> print(heisei.stringWidth('hello world',10))
|
||||
45.83
|
||||
"""
|
||||
|
||||
def __init__(self, face, isVertical=False, isHalfWidth=False):
|
||||
#pass
|
||||
try:
|
||||
lang, defaultEncoding = defaultUnicodeEncodings[face]
|
||||
except KeyError:
|
||||
raise KeyError("don't know anything about CID font %s" % face)
|
||||
|
||||
#we know the languages now.
|
||||
self.language = lang
|
||||
|
||||
#rebuilt encoding string. They follow rules which work
|
||||
#for the 7 fonts provided.
|
||||
enc = defaultEncoding[:-1]
|
||||
if isHalfWidth:
|
||||
enc = enc + 'HW-'
|
||||
if isVertical:
|
||||
enc = enc + 'V'
|
||||
else:
|
||||
enc = enc + 'H'
|
||||
|
||||
#now we can do the more general case
|
||||
CIDFont.__init__(self, face, enc)
|
||||
#self.encName = 'utf_16_le'
|
||||
#it's simpler for unicode, just use the face name
|
||||
self.name = self.fontName = face
|
||||
self.vertical = isVertical
|
||||
self.isHalfWidth = isHalfWidth
|
||||
|
||||
self.unicodeWidths = widthsByUnichar[self.name]
|
||||
|
||||
|
||||
def formatForPdf(self, text):
|
||||
#these ones should be encoded asUTF16 minus the BOM
|
||||
from codecs import utf_16_be_encode
|
||||
#print 'formatting %s: %s' % (type(text), repr(text))
|
||||
if isBytes(text):
|
||||
text = text.decode('utf8')
|
||||
utfText = utf_16_be_encode(text)[0]
|
||||
encoded = escapePDF(utfText)
|
||||
#print ' encoded:',encoded
|
||||
return encoded
|
||||
#
|
||||
#result = escapePDF(encoded)
|
||||
#print ' -> %s' % repr(result)
|
||||
#return result
|
||||
|
||||
|
||||
def stringWidth(self, text, size, encoding=None):
|
||||
"Just ensure we do width test on characters, not bytes..."
|
||||
if isBytes(text):
|
||||
text = text.decode('utf8')
|
||||
|
||||
widths = self.unicodeWidths
|
||||
return size * 0.001 * sum([widths.get(uch, 1000) for uch in text])
|
||||
#return CIDFont.stringWidth(self, text, size, encoding)
|
||||
|
||||
|
||||
def precalculate(cmapdir):
|
||||
# crunches through all, making 'fastmap' files
|
||||
import os
|
||||
files = os.listdir(cmapdir)
|
||||
for file in files:
|
||||
if os.path.isfile(cmapdir + os.sep + file + '.fastmap'):
|
||||
continue
|
||||
try:
|
||||
enc = CIDEncoding(file)
|
||||
except:
|
||||
print('cannot parse %s, skipping' % enc)
|
||||
continue
|
||||
enc.fastSave(cmapdir)
|
||||
print('saved %s.fastmap' % file)
|
||||
|
||||
def test():
|
||||
# only works if you have cirrect encodings on your box!
|
||||
c = Canvas('test_japanese.pdf')
|
||||
c.setFont('Helvetica', 30)
|
||||
c.drawString(100,700, 'Japanese Font Support')
|
||||
|
||||
pdfmetrics.registerFont(CIDFont('HeiseiMin-W3','90ms-RKSJ-H'))
|
||||
pdfmetrics.registerFont(CIDFont('HeiseiKakuGo-W5','90ms-RKSJ-H'))
|
||||
|
||||
|
||||
# the two typefaces
|
||||
c.setFont('HeiseiMin-W3-90ms-RKSJ-H', 16)
|
||||
# this says "This is HeiseiMincho" in shift-JIS. Not all our readers
|
||||
# have a Japanese PC, so I escaped it. On a Japanese-capable
|
||||
# system, print the string to see Kanji
|
||||
message1 = '\202\261\202\352\202\315\225\275\220\254\226\276\222\251\202\305\202\267\201B'
|
||||
c.drawString(100, 675, message1)
|
||||
c.save()
|
||||
print('saved test_japanese.pdf')
|
||||
|
||||
|
||||
## print 'CMAP_DIR = ', CMAP_DIR
|
||||
## tf1 = CIDTypeFace('HeiseiMin-W3')
|
||||
## print 'ascent = ',tf1.ascent
|
||||
## print 'descent = ',tf1.descent
|
||||
## for cid in [1,2,3,4,5,18,19,28,231,1742]:
|
||||
## print 'width of cid %d = %d' % (cid, tf1.getCharWidth(cid))
|
||||
|
||||
encName = '90ms-RKSJ-H'
|
||||
enc = CIDEncoding(encName)
|
||||
print(message1, '->', enc.translate(message1))
|
||||
|
||||
f = CIDFont('HeiseiMin-W3','90ms-RKSJ-H')
|
||||
print('width = %0.2f' % f.stringWidth(message1, 10))
|
||||
|
||||
|
||||
#testing all encodings
|
||||
## import time
|
||||
## started = time.time()
|
||||
## import glob
|
||||
## for encName in _cidfontdata.allowedEncodings:
|
||||
## #encName = '90ms-RKSJ-H'
|
||||
## enc = CIDEncoding(encName)
|
||||
## print 'encoding %s:' % encName
|
||||
## print ' codeSpaceRanges = %s' % enc._codeSpaceRanges
|
||||
## print ' notDefRanges = %s' % enc._notDefRanges
|
||||
## print ' mapping size = %d' % len(enc._cmap)
|
||||
## finished = time.time()
|
||||
## print 'constructed all encodings in %0.2f seconds' % (finished - started)
|
||||
|
||||
if __name__=='__main__':
|
||||
import doctest
|
||||
from reportlab.pdfbase import cidfonts
|
||||
doctest.testmod(cidfonts)
|
||||
#test()
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,582 @@
|
||||
|
||||
"""Support for Acrobat Forms in ReportLab documents
|
||||
|
||||
This module is somewhat experimental at this time.
|
||||
|
||||
Includes basic support for
|
||||
textfields,
|
||||
select fields (drop down lists), and
|
||||
check buttons.
|
||||
|
||||
The public interface consists of functions at the moment.
|
||||
At some later date these operations may be made into canvas
|
||||
methods. (comments?)
|
||||
|
||||
The ...Absolute(...) functions position the fields with respect
|
||||
to the absolute canvas coordinate space -- that is, they do not
|
||||
respect any coordinate transforms in effect for the canvas.
|
||||
|
||||
The ...Relative(...) functions position the ONLY THE LOWER LEFT
|
||||
CORNER of the field using the coordinate transform in effect for
|
||||
the canvas. THIS WILL ONLY WORK CORRECTLY FOR TRANSLATED COORDINATES
|
||||
-- THE SHAPE, SIZE, FONTSIZE, AND ORIENTATION OF THE FIELD WILL NOT BE EFFECTED
|
||||
BY SCALING, ROTATION, SKEWING OR OTHER NON-TRANSLATION COORDINATE
|
||||
TRANSFORMS.
|
||||
|
||||
Please note that all field names (titles) in a given document must be unique.
|
||||
Textfields and select fields only support the "base 14" canvas fonts
|
||||
at this time.
|
||||
|
||||
See individual function docstrings below for more information.
|
||||
|
||||
The function test1(...) generates a simple test file.
|
||||
|
||||
THIS CONTRIBUTION WAS COMMISSIONED BY REPORTLAB USERS
|
||||
WHO WISH TO REMAIN ANONYMOUS.
|
||||
"""
|
||||
|
||||
### NOTE: MAKE THE STRING FORMATS DYNAMIC IN PATTERNS TO SUPPORT ENCRYPTION XXXX
|
||||
|
||||
from reportlab.pdfbase.pdfdoc import PDFString, PDFStream, PDFDictionary, PDFName, PDFObject
|
||||
from reportlab.lib.colors import obj_R_G_B
|
||||
|
||||
#==========================public interfaces
|
||||
|
||||
def textFieldAbsolute(canvas, title, x, y, width, height, value="", maxlen=1000000, multiline=0):
|
||||
"""Place a text field on the current page
|
||||
with name title at ABSOLUTE position (x,y) with
|
||||
dimensions (width, height), using value as the default value and
|
||||
maxlen as the maximum permissible length. If multiline is set make
|
||||
it a multiline field.
|
||||
"""
|
||||
theform = getForm(canvas)
|
||||
return theform.textField(canvas, title, x, y, x+width, y+height, value, maxlen, multiline)
|
||||
|
||||
def textFieldRelative(canvas, title, xR, yR, width, height, value="", maxlen=1000000, multiline=0):
|
||||
"same as textFieldAbsolute except the x and y are relative to the canvas coordinate transform"
|
||||
(xA, yA) = canvas.absolutePosition(xR,yR)
|
||||
return textFieldAbsolute(canvas, title, xA, yA, width, height, value, maxlen, multiline)
|
||||
|
||||
def buttonFieldAbsolute(canvas, title, value, x, y, width=16.7704, height=14.907):
|
||||
"""Place a check button field on the current page
|
||||
with name title and default value value (one of "Yes" or "Off")
|
||||
at ABSOLUTE position (x,y).
|
||||
"""
|
||||
theform = getForm(canvas)
|
||||
return theform.buttonField(canvas, title, value, x, y, width=width, height=height)
|
||||
|
||||
def buttonFieldRelative(canvas, title, value, xR, yR, width=16.7704, height=14.907):
|
||||
"same as buttonFieldAbsolute except the x and y are relative to the canvas coordinate transform"
|
||||
(xA, yA) = canvas.absolutePosition(xR,yR)
|
||||
return buttonFieldAbsolute(canvas, title, value, xA, yA, width=width, height=height)
|
||||
|
||||
def selectFieldAbsolute(canvas, title, value, options, x, y, width, height):
|
||||
"""Place a select field (drop down list) on the current page
|
||||
with name title and
|
||||
with options listed in the sequence options
|
||||
default value value (must be one of options)
|
||||
at ABSOLUTE position (x,y) with dimensions (width, height)."""
|
||||
theform = getForm(canvas)
|
||||
theform.selectField(canvas, title, value, options, x, y, x+width, y+height)
|
||||
|
||||
def selectFieldRelative(canvas, title, value, options, xR, yR, width, height):
|
||||
"same as textFieldAbsolute except the x and y are relative to the canvas coordinate transform"
|
||||
(xA, yA) = canvas.absolutePosition(xR,yR)
|
||||
return selectFieldAbsolute(canvas, title, value, options, xA, yA, width, height)
|
||||
|
||||
#==========================end of public interfaces
|
||||
|
||||
from reportlab.pdfbase.pdfpattern import PDFPattern, PDFPatternIf
|
||||
|
||||
def getForm(canvas):
|
||||
"get form from canvas, create the form if needed"
|
||||
try:
|
||||
return canvas.AcroForm
|
||||
except AttributeError:
|
||||
theform = canvas.AcroForm = AcroForm()
|
||||
# install the form in the document
|
||||
d = canvas._doc
|
||||
cat = d._catalog
|
||||
cat.AcroForm = theform
|
||||
return theform
|
||||
|
||||
class AcroForm(PDFObject):
|
||||
def __init__(self):
|
||||
self.fields = []
|
||||
def textField(self, canvas, title, xmin, ymin, xmax, ymax, value="", maxlen=1000000, multiline=0):
|
||||
# determine the page ref
|
||||
doc = canvas._doc
|
||||
page = doc.thisPageRef()
|
||||
# determine text info
|
||||
R, G, B = obj_R_G_B(canvas._fillColorObj)
|
||||
#print "rgb", (R,G,B)
|
||||
font = canvas. _fontname
|
||||
fontsize = canvas. _fontsize
|
||||
field = TextField(title, value, xmin, ymin, xmax, ymax, page, maxlen,
|
||||
font, fontsize, R, G, B, multiline)
|
||||
self.fields.append(field)
|
||||
canvas._addAnnotation(field)
|
||||
def selectField(self, canvas, title, value, options, xmin, ymin, xmax, ymax):
|
||||
# determine the page ref
|
||||
doc = canvas._doc
|
||||
page = doc.thisPageRef()
|
||||
# determine text info
|
||||
R, G, B = obj_R_G_B(canvas._fillColorObj)
|
||||
#print "rgb", (R,G,B)
|
||||
font = canvas. _fontname
|
||||
fontsize = canvas. _fontsize
|
||||
field = SelectField(title, value, options, xmin, ymin, xmax, ymax, page,
|
||||
font=font, fontsize=fontsize, R=R, G=G, B=B)
|
||||
self.fields.append(field)
|
||||
canvas._addAnnotation(field)
|
||||
def buttonField(self, canvas, title, value, xmin, ymin, width=16.7704, height=14.907):
|
||||
# determine the page ref
|
||||
doc = canvas._doc
|
||||
page = doc.thisPageRef()
|
||||
field = ButtonField(title, value, xmin, ymin, page, width=width, height=height)
|
||||
self.fields.append(field)
|
||||
canvas._addAnnotation(field)
|
||||
def format(self, document):
|
||||
from reportlab.pdfbase.pdfdoc import PDFArray
|
||||
proxy = PDFPattern(FormPattern,
|
||||
Resources=getattr(self,'resources',None) or FormResources(),
|
||||
NeedAppearances=getattr(self,'needAppearances','false'),
|
||||
fields=PDFArray(self.fields), SigFlags=getattr(self,'sigFlags',0))
|
||||
return proxy.format(document)
|
||||
|
||||
FormPattern = [
|
||||
'<<\r\n',
|
||||
'/NeedAppearances ',['NeedAppearances'],'\r\n'
|
||||
'/DA ', PDFString('/Helv 0 Tf 0 g '), '\r\n',
|
||||
'/DR ',["Resources"],'\r\n',
|
||||
'/Fields ', ["fields"],'\r\n',
|
||||
PDFPatternIf('SigFlags',['\r\n/SigFlags ',['SigFlags']]),
|
||||
'>>'
|
||||
]
|
||||
|
||||
def FormFontsDictionary():
|
||||
from reportlab.pdfbase.pdfdoc import PDFDictionary
|
||||
fontsdictionary = PDFDictionary()
|
||||
fontsdictionary.__RefOnly__ = 1
|
||||
for fullname, shortname in FORMFONTNAMES.items():
|
||||
fontsdictionary[shortname] = FormFont(fullname, shortname)
|
||||
fontsdictionary["ZaDb"] = PDFPattern(ZaDbPattern)
|
||||
return fontsdictionary
|
||||
|
||||
def FormResources():
|
||||
return PDFPattern(FormResourcesDictionaryPattern,
|
||||
Encoding=PDFPattern(EncodingPattern,PDFDocEncoding=PDFPattern(PDFDocEncodingPattern)),
|
||||
Font=FormFontsDictionary())
|
||||
|
||||
ZaDbPattern = [
|
||||
' <<'
|
||||
' /BaseFont'
|
||||
' /ZapfDingbats'
|
||||
' /Name'
|
||||
' /ZaDb'
|
||||
' /Subtype'
|
||||
' /Type1'
|
||||
' /Type'
|
||||
' /Font'
|
||||
'>>']
|
||||
|
||||
|
||||
FormResourcesDictionaryPattern = [
|
||||
'<<',
|
||||
' /Encoding ',
|
||||
["Encoding"], '\r\n',
|
||||
' /Font ',
|
||||
["Font"], '\r\n',
|
||||
'>>'
|
||||
]
|
||||
|
||||
FORMFONTNAMES = {
|
||||
"Helvetica": "Helv",
|
||||
"Helvetica-Bold": "HeBo",
|
||||
'Courier': "Cour",
|
||||
'Courier-Bold': "CoBo",
|
||||
'Courier-Oblique': "CoOb",
|
||||
'Courier-BoldOblique': "CoBO",
|
||||
'Helvetica-Oblique': "HeOb",
|
||||
'Helvetica-BoldOblique': "HeBO",
|
||||
'Times-Roman': "Time",
|
||||
'Times-Bold': "TiBo",
|
||||
'Times-Italic': "TiIt",
|
||||
'Times-BoldItalic': "TiBI",
|
||||
}
|
||||
|
||||
EncodingPattern = [
|
||||
'<<',
|
||||
' /PDFDocEncoding ',
|
||||
["PDFDocEncoding"], '\r\n',
|
||||
'>>',
|
||||
]
|
||||
|
||||
PDFDocEncodingPattern = [
|
||||
'<<'
|
||||
' /Differences'
|
||||
' ['
|
||||
' 24'
|
||||
' /breve'
|
||||
' /caron'
|
||||
' /circumflex'
|
||||
' /dotaccent'
|
||||
' /hungarumlaut'
|
||||
' /ogonek'
|
||||
' /ring'
|
||||
' /tilde'
|
||||
' 39'
|
||||
' /quotesingle'
|
||||
' 96'
|
||||
' /grave'
|
||||
' 128'
|
||||
' /bullet'
|
||||
' /dagger'
|
||||
' /daggerdbl'
|
||||
' /ellipsis'
|
||||
' /emdash'
|
||||
' /endash'
|
||||
' /florin'
|
||||
' /fraction'
|
||||
' /guilsinglleft'
|
||||
' /guilsinglright'
|
||||
' /minus'
|
||||
' /perthousand'
|
||||
' /quotedblbase'
|
||||
' /quotedblleft'
|
||||
' /quotedblright'
|
||||
' /quoteleft'
|
||||
' /quoteright'
|
||||
' /quotesinglbase'
|
||||
' /trademark'
|
||||
' /fi'
|
||||
' /fl'
|
||||
' /Lslash'
|
||||
' /OE'
|
||||
' /Scaron'
|
||||
' /Ydieresis'
|
||||
' /Zcaron'
|
||||
' /dotlessi'
|
||||
' /lslash'
|
||||
' /oe'
|
||||
' /scaron'
|
||||
' /zcaron'
|
||||
' 160'
|
||||
' /Euro'
|
||||
' 164'
|
||||
' /currency'
|
||||
' 166'
|
||||
' /brokenbar'
|
||||
' 168'
|
||||
' /dieresis'
|
||||
' /copyright'
|
||||
' /ordfeminine'
|
||||
' 172'
|
||||
' /logicalnot'
|
||||
' /.notdef'
|
||||
' /registered'
|
||||
' /macron'
|
||||
' /degree'
|
||||
' /plusminus'
|
||||
' /twosuperior'
|
||||
' /threesuperior'
|
||||
' /acute'
|
||||
' /mu'
|
||||
' 183'
|
||||
' /periodcentered'
|
||||
' /cedilla'
|
||||
' /onesuperior'
|
||||
' /ordmasculine'
|
||||
' 188'
|
||||
' /onequarter'
|
||||
' /onehalf'
|
||||
' /threequarters'
|
||||
' 192'
|
||||
' /Agrave'
|
||||
' /Aacute'
|
||||
' /Acircumflex'
|
||||
' /Atilde'
|
||||
' /Adieresis'
|
||||
' /Aring'
|
||||
' /AE'
|
||||
' /Ccedilla'
|
||||
' /Egrave'
|
||||
' /Eacute'
|
||||
' /Ecircumflex'
|
||||
' /Edieresis'
|
||||
' /Igrave'
|
||||
' /Iacute'
|
||||
' /Icircumflex'
|
||||
' /Idieresis'
|
||||
' /Eth'
|
||||
' /Ntilde'
|
||||
' /Ograve'
|
||||
' /Oacute'
|
||||
' /Ocircumflex'
|
||||
' /Otilde'
|
||||
' /Odieresis'
|
||||
' /multiply'
|
||||
' /Oslash'
|
||||
' /Ugrave'
|
||||
' /Uacute'
|
||||
' /Ucircumflex'
|
||||
' /Udieresis'
|
||||
' /Yacute'
|
||||
' /Thorn'
|
||||
' /germandbls'
|
||||
' /agrave'
|
||||
' /aacute'
|
||||
' /acircumflex'
|
||||
' /atilde'
|
||||
' /adieresis'
|
||||
' /aring'
|
||||
' /ae'
|
||||
' /ccedilla'
|
||||
' /egrave'
|
||||
' /eacute'
|
||||
' /ecircumflex'
|
||||
' /edieresis'
|
||||
' /igrave'
|
||||
' /iacute'
|
||||
' /icircumflex'
|
||||
' /idieresis'
|
||||
' /eth'
|
||||
' /ntilde'
|
||||
' /ograve'
|
||||
' /oacute'
|
||||
' /ocircumflex'
|
||||
' /otilde'
|
||||
' /odieresis'
|
||||
' /divide'
|
||||
' /oslash'
|
||||
' /ugrave'
|
||||
' /uacute'
|
||||
' /ucircumflex'
|
||||
' /udieresis'
|
||||
' /yacute'
|
||||
' /thorn'
|
||||
' /ydieresis'
|
||||
' ]'
|
||||
' /Type'
|
||||
' /Encoding'
|
||||
'>>']
|
||||
|
||||
def FormFont(BaseFont, Name):
|
||||
from reportlab.pdfbase.pdfdoc import PDFName
|
||||
return PDFPattern(FormFontPattern, BaseFont=PDFName(BaseFont), Name=PDFName(Name), Encoding=PDFPattern(PDFDocEncodingPattern))
|
||||
|
||||
FormFontPattern = [
|
||||
'<<',
|
||||
' /BaseFont ',
|
||||
["BaseFont"], '\r\n',
|
||||
' /Encoding ',
|
||||
["Encoding"], '\r\n',
|
||||
' /Name ',
|
||||
["Name"], '\r\n',
|
||||
' /Subtype '
|
||||
' /Type1 '
|
||||
' /Type '
|
||||
' /Font '
|
||||
'>>' ]
|
||||
|
||||
def resetPdfForm():
|
||||
pass
|
||||
from reportlab.rl_config import register_reset
|
||||
register_reset(resetPdfForm)
|
||||
resetPdfForm()
|
||||
|
||||
def TextField(title, value, xmin, ymin, xmax, ymax, page,
|
||||
maxlen=1000000, font="Helvetica-Bold", fontsize=9, R=0, G=0, B=0.627, multiline=0):
|
||||
from reportlab.pdfbase.pdfdoc import PDFString, PDFName
|
||||
Flags = 0
|
||||
if multiline:
|
||||
Flags = Flags | (1<<12) # bit 13 is at position 12 :)
|
||||
fontname = FORMFONTNAMES[font]
|
||||
return PDFPattern(TextFieldPattern,
|
||||
value=PDFString(value), maxlen=maxlen, page=page,
|
||||
title=PDFString(title),
|
||||
xmin=xmin, ymin=ymin, xmax=xmax, ymax=ymax,
|
||||
fontname=PDFName(fontname), fontsize=fontsize, R=R, G=G, B=B, Flags=Flags)
|
||||
|
||||
|
||||
TextFieldPattern = [
|
||||
'<<'
|
||||
' /DA'
|
||||
' (', ["fontname"],' ',["fontsize"],' Tf ',["R"],' ',["G"],' ',["B"],' rg)'
|
||||
' /DV ',
|
||||
["value"], '\r\n',
|
||||
' /F 4 /FT /Tx'
|
||||
'/MK << /BC [ 0 0 0 ] >>'
|
||||
' /MaxLen ',
|
||||
["maxlen"], '\r\n',
|
||||
' /P ',
|
||||
["page"], '\r\n',
|
||||
' /Rect '
|
||||
' [', ["xmin"], " ", ["ymin"], " ", ["xmax"], " ", ["ymax"], ' ]'
|
||||
'/Subtype /Widget'
|
||||
' /T ',
|
||||
["title"], '\r\n',
|
||||
' /Type'
|
||||
' /Annot'
|
||||
' /V ',
|
||||
["value"], '\r\n',
|
||||
' /Ff ',
|
||||
["Flags"],'\r\n',
|
||||
'>>']
|
||||
|
||||
def SelectField(title, value, options, xmin, ymin, xmax, ymax, page,
|
||||
font="Helvetica-Bold", fontsize=9, R=0, G=0, B=0.627):
|
||||
#print "ARGS", (title, value, options, xmin, ymin, xmax, ymax, page, font, fontsize, R, G, B)
|
||||
from reportlab.pdfbase.pdfdoc import PDFString, PDFName, PDFArray
|
||||
if value not in options:
|
||||
raise ValueError("value %s must be one of options %s" % (repr(value), repr(options)))
|
||||
fontname = FORMFONTNAMES[font]
|
||||
optionstrings = list(map(PDFString, options))
|
||||
optionarray = PDFArray(optionstrings)
|
||||
return PDFPattern(SelectFieldPattern,
|
||||
Options=optionarray,
|
||||
Selected=PDFString(value), Page=page,
|
||||
Name=PDFString(title),
|
||||
xmin=xmin, ymin=ymin, xmax=xmax, ymax=ymax,
|
||||
fontname=PDFName(fontname), fontsize=fontsize, R=R, G=G, B=B)
|
||||
|
||||
SelectFieldPattern = [
|
||||
'<< % a select list\r\n'
|
||||
' /DA ',
|
||||
' (', ["fontname"],' ',["fontsize"],' Tf ',["R"],' ',["G"],' ',["B"],' rg)\r\n',
|
||||
#' (/Helv 12 Tf 0 g)\r\n',
|
||||
' /DV ',
|
||||
["Selected"],'\r\n',
|
||||
' /F ',
|
||||
' 4\r\n',
|
||||
' /FT ',
|
||||
' /Ch\r\n',
|
||||
' /MK ',
|
||||
' <<',
|
||||
' /BC',
|
||||
' [',
|
||||
' 0',
|
||||
' 0',
|
||||
' 0',
|
||||
' ]',
|
||||
' /BG',
|
||||
' [',
|
||||
' 1',
|
||||
' 1',
|
||||
' 1',
|
||||
' ]',
|
||||
' >>\r\n',
|
||||
' /Opt ',
|
||||
["Options"],'\r\n',
|
||||
' /P ',
|
||||
["Page"],'\r\n',
|
||||
'/Rect',
|
||||
' [',["xmin"], " ", ["ymin"], " ", ["xmax"], " ", ["ymax"],
|
||||
' ] \r\n',
|
||||
'/Subtype',
|
||||
' /Widget\r\n',
|
||||
' /T ',
|
||||
["Name"],'\r\n',
|
||||
' /Type ',
|
||||
' /Annot',
|
||||
' /V ',
|
||||
["Selected"],'\r\n',
|
||||
'>>']
|
||||
|
||||
def ButtonField(title, value, xmin, ymin, page, width=16.7704, height=14.907):
|
||||
if value not in ("Yes", "Off"):
|
||||
raise ValueError("button value must be 'Yes' or 'Off': "+repr(value))
|
||||
fontSize = (11.3086/14.907)*height
|
||||
dx = (3.6017/16.7704)*width
|
||||
dy = (3.3881/14.907)*height
|
||||
return PDFPattern(ButtonFieldPattern,
|
||||
Name=PDFString(title),
|
||||
xmin=xmin, ymin=ymin, xmax=xmin+width, ymax=ymin+width,
|
||||
Hide=PDFPattern(['<< /S /Hide >>']),
|
||||
APDOff=ButtonStream('0.749 g 0 0 %(width)s %(height)s re f\r\n' % vars(), width=width, height=height),
|
||||
APDYes=ButtonStream('0.749 g 0 0 %(width)s %(height)s re f q 1 1 %(width)s %(height)s re W n BT /ZaDb %(fontSize)s Tf 0 g 1 0 0 1 %(dx)s %(dy)s Tm (4) Tj ET\r\n' % vars(),
|
||||
width=width, height=height),
|
||||
APNYes=ButtonStream('q 1 1 %(width)s %(height)s re W n BT /ZaDb %(fontSize)s Tf 0 g 1 0 0 1 %(dx)s %(dy)s Tm (4) Tj ET Q\r\n' % vars(),
|
||||
width=width, height=height),
|
||||
Value=PDFName(value),
|
||||
Page=page)
|
||||
|
||||
ButtonFieldPattern = ['<< ',
|
||||
'/AA',
|
||||
' <<',
|
||||
' /D ',
|
||||
["Hide"],'\r\n',
|
||||
#' %(imported.18.0)s',
|
||||
' >> ',
|
||||
'/AP ',
|
||||
' <<',
|
||||
' /D',
|
||||
' <<',
|
||||
' /Off ',
|
||||
#' %(imported.40.0)s',
|
||||
["APDOff"], '\r\n',
|
||||
' /Yes ',
|
||||
#' %(imported.39.0)s',
|
||||
["APDYes"], '\r\n',
|
||||
' >>', '\r\n',
|
||||
' /N',
|
||||
' << ',
|
||||
' /Yes ',
|
||||
#' %(imported.38.0)s',
|
||||
["APNYes"], '\r\n',
|
||||
' >>',
|
||||
' >>\r\n',
|
||||
' /AS ',
|
||||
["Value"], '\r\n',
|
||||
' /DA ',
|
||||
PDFString('/ZaDb 0 Tf 0 g'), '\r\n',
|
||||
'/DV ',
|
||||
["Value"], '\r\n',
|
||||
'/F ',
|
||||
' 4 ',
|
||||
'/FT ',
|
||||
' /Btn ',
|
||||
'/H ',
|
||||
' /T ',
|
||||
'/MK ',
|
||||
' <<',
|
||||
' /AC (\\376\\377)',
|
||||
#PDFString('\376\377'),
|
||||
' /CA ',
|
||||
PDFString('4'),
|
||||
' /RC ',
|
||||
PDFString('\376\377'),
|
||||
' >> ','\r\n',
|
||||
'/P ',
|
||||
["Page"], '\r\n',
|
||||
'/Rect',
|
||||
' [',["xmin"], " ", ["ymin"], " ", ["xmax"], " ", ["ymax"],
|
||||
' ] ','\r\n',
|
||||
'/Subtype',
|
||||
' /Widget ',
|
||||
'/T ',
|
||||
["Name"], '\r\n',
|
||||
'/Type',
|
||||
' /Annot ',
|
||||
'/V ',
|
||||
["Value"], '\r\n',
|
||||
' >>']
|
||||
|
||||
|
||||
def buttonStreamDictionary(width=16.7704, height=14.907):
|
||||
"everything except the length for the button appearance streams"
|
||||
result = PDFDictionary()
|
||||
result["SubType"] = "/Form"
|
||||
result["BBox"] = "[0 0 %(width)s %(height)s]" % vars()
|
||||
font = PDFDictionary()
|
||||
font["ZaDb"] = PDFPattern(ZaDbPattern)
|
||||
resources = PDFDictionary()
|
||||
resources["ProcSet"] = "[ /PDF /Text ]"
|
||||
resources["Font"] = font
|
||||
result["Resources"] = resources
|
||||
return result
|
||||
|
||||
def ButtonStream(content, width=16.7704, height=14.907):
|
||||
result = PDFStream(buttonStreamDictionary(width=width,height=height), content)
|
||||
result.filters = []
|
||||
return result
|
||||
@@ -0,0 +1,828 @@
|
||||
#Copyright ReportLab Europe Ltd. 2000-2017
|
||||
#see license.txt for license details
|
||||
#history https://hg.reportlab.com/hg-public/reportlab/log/tip/src/reportlab/pdfbase/pdfmetrics.py
|
||||
#$Header $
|
||||
__version__='3.3.0'
|
||||
__doc__="""This provides a database of font metric information and
|
||||
efines Font, Encoding and TypeFace classes aimed at end users.
|
||||
|
||||
There are counterparts to some of these in pdfbase/pdfdoc.py, but
|
||||
the latter focus on constructing the right PDF objects. These
|
||||
classes are declarative and focus on letting the user construct
|
||||
and query font objects.
|
||||
|
||||
The module maintains a registry of font objects at run time.
|
||||
|
||||
It is independent of the canvas or any particular context. It keeps
|
||||
a registry of Font, TypeFace and Encoding objects. Ideally these
|
||||
would be pre-loaded, but due to a nasty circularity problem we
|
||||
trap attempts to access them and do it on first access.
|
||||
"""
|
||||
import os, sys, encodings
|
||||
from reportlab.pdfbase import _fontdata
|
||||
from reportlab.lib.logger import warnOnce
|
||||
from reportlab.lib.utils import rl_isfile, rl_glob, rl_isdir, open_and_read, open_and_readlines, findInPaths, isSeq, isStr
|
||||
from reportlab.rl_config import defaultEncoding, T1SearchPath
|
||||
from reportlab.lib.rl_accel import unicode2T1, instanceStringWidthT1
|
||||
from reportlab.pdfbase import rl_codecs
|
||||
_notdefChar = b'n'
|
||||
|
||||
rl_codecs.RL_Codecs.register()
|
||||
standardFonts = _fontdata.standardFonts
|
||||
standardEncodings = _fontdata.standardEncodings
|
||||
|
||||
_typefaces = {}
|
||||
_encodings = {}
|
||||
_fonts = {}
|
||||
_dynFaceNames = {} #record dynamicFont face names
|
||||
|
||||
class FontError(Exception):
|
||||
pass
|
||||
class FontNotFoundError(Exception):
|
||||
pass
|
||||
|
||||
def parseAFMFile(afmFileName):
|
||||
"""Quick and dirty - gives back a top-level dictionary
|
||||
with top-level items, and a 'widths' key containing
|
||||
a dictionary of glyph names and widths. Just enough
|
||||
needed for embedding. A better parser would accept
|
||||
options for what data you wwanted, and preserve the
|
||||
order."""
|
||||
|
||||
lines = open_and_readlines(afmFileName, 'r')
|
||||
if len(lines)<=1:
|
||||
#likely to be a MAC file
|
||||
if lines: lines = lines[0].split('\r')
|
||||
if len(lines)<=1:
|
||||
raise ValueError('AFM file %s hasn\'t enough data' % afmFileName)
|
||||
topLevel = {}
|
||||
glyphLevel = []
|
||||
|
||||
lines = [l.strip() for l in lines]
|
||||
lines = [l for l in lines if not l.lower().startswith('comment')]
|
||||
#pass 1 - get the widths
|
||||
inMetrics = 0 # os 'TOP', or 'CHARMETRICS'
|
||||
for line in lines:
|
||||
if line[0:16] == 'StartCharMetrics':
|
||||
inMetrics = 1
|
||||
elif line[0:14] == 'EndCharMetrics':
|
||||
inMetrics = 0
|
||||
elif inMetrics:
|
||||
chunks = line.split(';')
|
||||
chunks = [chunk.strip() for chunk in chunks]
|
||||
cidChunk, widthChunk, nameChunk = chunks[0:3]
|
||||
|
||||
# character ID
|
||||
l, r = cidChunk.split()
|
||||
assert l == 'C', 'bad line in font file %s' % line
|
||||
cid = int(r)
|
||||
|
||||
# width
|
||||
l, r = widthChunk.split()
|
||||
assert l == 'WX', 'bad line in font file %s' % line
|
||||
try:
|
||||
width = int(r)
|
||||
except ValueError:
|
||||
width = float(r)
|
||||
|
||||
# name
|
||||
l, r = nameChunk.split()
|
||||
assert l == 'N', 'bad line in font file %s' % line
|
||||
name = r
|
||||
|
||||
glyphLevel.append((cid, width, name))
|
||||
|
||||
# pass 2 font info
|
||||
inHeader = 0
|
||||
for line in lines:
|
||||
if line[0:16] == 'StartFontMetrics':
|
||||
inHeader = 1
|
||||
if line[0:16] == 'StartCharMetrics':
|
||||
inHeader = 0
|
||||
elif inHeader:
|
||||
if line[0:7] == 'Comment': pass
|
||||
try:
|
||||
left, right = line.split(' ',1)
|
||||
except:
|
||||
raise ValueError("Header information error in afm %s: line='%s'" % (afmFileName, line))
|
||||
try:
|
||||
right = int(right)
|
||||
except:
|
||||
pass
|
||||
topLevel[left] = right
|
||||
|
||||
|
||||
return (topLevel, glyphLevel)
|
||||
|
||||
class TypeFace:
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
self.glyphNames = []
|
||||
self.glyphWidths = {}
|
||||
self.ascent = 0
|
||||
self.descent = 0
|
||||
|
||||
|
||||
# all typefaces of whatever class should have these 3 attributes.
|
||||
# these are the basis for family detection.
|
||||
self.familyName = None # should set on load/construction if possible
|
||||
self.bold = 0 # bold faces should set this
|
||||
self.italic = 0 #italic faces should set this
|
||||
|
||||
if name == 'ZapfDingbats':
|
||||
self.requiredEncoding = 'ZapfDingbatsEncoding'
|
||||
elif name == 'Symbol':
|
||||
self.requiredEncoding = 'SymbolEncoding'
|
||||
else:
|
||||
self.requiredEncoding = None
|
||||
if name in standardFonts:
|
||||
self.builtIn = 1
|
||||
self._loadBuiltInData(name)
|
||||
else:
|
||||
self.builtIn = 0
|
||||
|
||||
def _loadBuiltInData(self, name):
|
||||
"""Called for the built in 14 fonts. Gets their glyph data.
|
||||
We presume they never change so this can be a shared reference."""
|
||||
name = str(name) #needed for pycanvas&jython/2.1 compatibility
|
||||
self.glyphWidths = _fontdata.widthsByFontGlyph[name]
|
||||
self.glyphNames = list(self.glyphWidths.keys())
|
||||
self.ascent,self.descent = _fontdata.ascent_descent[name]
|
||||
|
||||
def getFontFiles(self):
|
||||
"Info function, return list of the font files this depends on."
|
||||
return []
|
||||
|
||||
def findT1File(self, ext='.pfb'):
|
||||
possible_exts = (ext.lower(), ext.upper())
|
||||
if hasattr(self,'pfbFileName'):
|
||||
r_basename = os.path.splitext(self.pfbFileName)[0]
|
||||
for e in possible_exts:
|
||||
if rl_isfile(r_basename + e):
|
||||
return r_basename + e
|
||||
try:
|
||||
r = _fontdata.findT1File(self.name)
|
||||
except:
|
||||
afm = bruteForceSearchForAFM(self.name)
|
||||
if afm:
|
||||
if ext.lower() == '.pfb':
|
||||
for e in possible_exts:
|
||||
pfb = os.path.splitext(afm)[0] + e
|
||||
if rl_isfile(pfb):
|
||||
r = pfb
|
||||
else:
|
||||
r = None
|
||||
elif ext.lower() == '.afm':
|
||||
r = afm
|
||||
else:
|
||||
r = None
|
||||
if r is None:
|
||||
warnOnce("Can't find %s for face '%s'" % (ext, self.name))
|
||||
return r
|
||||
|
||||
def bruteForceSearchForFile(fn,searchPath=None):
|
||||
if searchPath is None: from reportlab.rl_config import T1SearchPath as searchPath
|
||||
if rl_isfile(fn): return fn
|
||||
bfn = os.path.basename(fn)
|
||||
for dirname in searchPath:
|
||||
if not rl_isdir(dirname): continue
|
||||
tfn = os.path.join(dirname,bfn)
|
||||
if rl_isfile(tfn): return tfn
|
||||
return fn
|
||||
|
||||
def bruteForceSearchForAFM(faceName):
|
||||
"""Looks in all AFM files on path for face with given name.
|
||||
|
||||
Returns AFM file name or None. Ouch!"""
|
||||
from reportlab.rl_config import T1SearchPath
|
||||
|
||||
for dirname in T1SearchPath:
|
||||
if not rl_isdir(dirname): continue
|
||||
possibles = rl_glob(dirname + os.sep + '*.[aA][fF][mM]')
|
||||
for possible in possibles:
|
||||
try:
|
||||
topDict, glyphDict = parseAFMFile(possible)
|
||||
if topDict['FontName'] == faceName:
|
||||
return possible
|
||||
except:
|
||||
t,v,b=sys.exc_info()
|
||||
v.args = (' '.join(map(str,v.args))+', while looking for faceName=%r' % faceName,)
|
||||
raise
|
||||
|
||||
|
||||
#for faceName in standardFonts:
|
||||
# registerTypeFace(TypeFace(faceName))
|
||||
|
||||
|
||||
class Encoding:
|
||||
"""Object to help you create and refer to encodings."""
|
||||
def __init__(self, name, base=None):
|
||||
self.name = name
|
||||
self.frozen = 0
|
||||
if name in standardEncodings:
|
||||
assert base is None, "Can't have a base encoding for a standard encoding"
|
||||
self.baseEncodingName = name
|
||||
self.vector = _fontdata.encodings[name]
|
||||
elif base == None:
|
||||
# assume based on the usual one
|
||||
self.baseEncodingName = defaultEncoding
|
||||
self.vector = _fontdata.encodings[defaultEncoding]
|
||||
elif isStr(base):
|
||||
baseEnc = getEncoding(base)
|
||||
self.baseEncodingName = baseEnc.name
|
||||
self.vector = baseEnc.vector[:]
|
||||
elif isSeq(base):
|
||||
self.baseEncodingName = defaultEncoding
|
||||
self.vector = base[:]
|
||||
elif isinstance(base, Encoding):
|
||||
# accept a vector
|
||||
self.baseEncodingName = base.name
|
||||
self.vector = base.vector[:]
|
||||
|
||||
def __getitem__(self, index):
|
||||
"Return glyph name for that code point, or None"
|
||||
# THIS SHOULD BE INLINED FOR SPEED
|
||||
return self.vector[index]
|
||||
|
||||
def __setitem__(self, index, value):
|
||||
# should fail if they are frozen
|
||||
assert self.frozen == 0, 'Cannot modify a frozen encoding'
|
||||
if self.vector[index]!=value:
|
||||
L = list(self.vector)
|
||||
L[index] = value
|
||||
self.vector = tuple(L)
|
||||
|
||||
def freeze(self):
|
||||
self.vector = tuple(self.vector)
|
||||
self.frozen = 1
|
||||
|
||||
def isEqual(self, other):
|
||||
return self.name==other.name and tuple(self.vector)==tuple(other.vector)
|
||||
|
||||
def modifyRange(self, base, newNames):
|
||||
"""Set a group of character names starting at the code point 'base'."""
|
||||
assert self.frozen == 0, 'Cannot modify a frozen encoding'
|
||||
idx = base
|
||||
for name in newNames:
|
||||
self.vector[idx] = name
|
||||
idx = idx + 1
|
||||
|
||||
def getDifferences(self, otherEnc):
|
||||
"""
|
||||
Return a compact list of the code points differing between two encodings
|
||||
|
||||
This is in the Adobe format: list of
|
||||
[[b1, name1, name2, name3],
|
||||
[b2, name4]]
|
||||
|
||||
where b1...bn is the starting code point, and the glyph names following
|
||||
are assigned consecutive code points.
|
||||
|
||||
"""
|
||||
|
||||
ranges = []
|
||||
curRange = None
|
||||
for i in range(len(self.vector)):
|
||||
glyph = self.vector[i]
|
||||
if glyph==otherEnc.vector[i]:
|
||||
if curRange:
|
||||
ranges.append(curRange)
|
||||
curRange = []
|
||||
else:
|
||||
if curRange:
|
||||
curRange.append(glyph)
|
||||
elif glyph:
|
||||
curRange = [i, glyph]
|
||||
if curRange:
|
||||
ranges.append(curRange)
|
||||
return ranges
|
||||
|
||||
def makePDFObject(self):
|
||||
"Returns a PDF Object representing self"
|
||||
# avoid circular imports - this cannot go at module level
|
||||
from reportlab.pdfbase import pdfdoc
|
||||
|
||||
D = {}
|
||||
baseEncodingName = self.baseEncodingName
|
||||
baseEnc = getEncoding(baseEncodingName)
|
||||
differences = self.getDifferences(baseEnc) #[None] * 256)
|
||||
|
||||
# if no differences, we just need the base name
|
||||
if differences == []:
|
||||
return pdfdoc.PDFName(baseEncodingName)
|
||||
else:
|
||||
#make up a dictionary describing the new encoding
|
||||
diffArray = []
|
||||
for range in differences:
|
||||
diffArray.append(range[0]) # numbers go 'as is'
|
||||
for glyphName in range[1:]:
|
||||
if glyphName is not None:
|
||||
# there is no way to 'unset' a character in the base font.
|
||||
diffArray.append('/' + glyphName)
|
||||
|
||||
#print 'diffArray = %s' % diffArray
|
||||
D["Differences"] = pdfdoc.PDFArray(diffArray)
|
||||
if baseEncodingName in ('MacRomanEncoding','MacExpertEncoding','WinAnsiEncoding'):
|
||||
#https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf page 263
|
||||
D["BaseEncoding"] = pdfdoc.PDFName(baseEncodingName)
|
||||
D["Type"] = pdfdoc.PDFName("Encoding")
|
||||
PD = pdfdoc.PDFDictionary(D)
|
||||
return PD
|
||||
|
||||
#for encName in standardEncodings:
|
||||
# registerEncoding(Encoding(encName))
|
||||
|
||||
|
||||
standardT1SubstitutionFonts = []
|
||||
class Font:
|
||||
"""Represents a font (i.e combination of face and encoding).
|
||||
|
||||
Defines suitable machinery for single byte fonts. This is
|
||||
a concrete class which can handle the basic built-in fonts;
|
||||
not clear yet if embedded ones need a new font class or
|
||||
just a new typeface class (which would do the job through
|
||||
composition)"""
|
||||
|
||||
_multiByte = 0 # do not want our own stringwidth
|
||||
_dynamicFont = 0 # do not want dynamic subsetting
|
||||
shapable = False
|
||||
|
||||
def __init__(self, name, faceName, encName, substitutionFonts=None):
|
||||
self.fontName = name
|
||||
face = self.face = getTypeFace(faceName)
|
||||
self.encoding= getEncoding(encName)
|
||||
self.encName = encName
|
||||
self.substitutionFonts = (standardT1SubstitutionFonts
|
||||
if face.builtIn and face.requiredEncoding is None
|
||||
else substitutionFonts or [])
|
||||
self._calcWidths()
|
||||
self._notdefChar = _notdefChar
|
||||
self._notdefFont = name=='ZapfDingbats' and self or _notdefFont
|
||||
|
||||
def stringWidth(self, text, size, encoding='utf8'):
|
||||
return instanceStringWidthT1(self, text, size, encoding=encoding)
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s %s>" % (self.__class__.__name__, self.face.name)
|
||||
|
||||
def _calcWidths(self):
|
||||
"""Vector of widths for stringWidth function"""
|
||||
#synthesize on first request
|
||||
w = [0] * 256
|
||||
gw = self.face.glyphWidths
|
||||
vec = self.encoding.vector
|
||||
for i in range(256):
|
||||
glyphName = vec[i]
|
||||
if glyphName is not None:
|
||||
try:
|
||||
width = gw[glyphName]
|
||||
w[i] = width
|
||||
except KeyError:
|
||||
import reportlab.rl_config
|
||||
if reportlab.rl_config.warnOnMissingFontGlyphs:
|
||||
print('typeface "%s" does not have a glyph "%s", bad font!' % (self.face.name, glyphName))
|
||||
else:
|
||||
pass
|
||||
self.widths = w
|
||||
|
||||
def _formatWidths(self):
|
||||
"returns a pretty block in PDF Array format to aid inspection"
|
||||
text = b'['
|
||||
for i in range(256):
|
||||
text = text + b' ' + bytes(str(self.widths[i]),'utf8')
|
||||
if i == 255:
|
||||
text = text + b' ]'
|
||||
if i % 16 == 15:
|
||||
text = text + b'\n'
|
||||
return text
|
||||
|
||||
def addObjects(self, doc):
|
||||
"""Makes and returns one or more PDF objects to be added
|
||||
to the document. The caller supplies the internal name
|
||||
to be used (typically F1, F2... in sequence) """
|
||||
# avoid circular imports - this cannot go at module level
|
||||
from reportlab.pdfbase import pdfdoc
|
||||
|
||||
# construct a Type 1 Font internal object
|
||||
internalName = 'F' + repr(len(doc.fontMapping)+1)
|
||||
pdfFont = pdfdoc.PDFType1Font()
|
||||
pdfFont.Name = internalName
|
||||
pdfFont.BaseFont = self.face.name
|
||||
pdfFont.__Comment__ = 'Font %s' % self.fontName
|
||||
e = self.encoding.makePDFObject()
|
||||
if not isStr(e) or e in ('/MacRomanEncoding','/MacExpertEncoding','/WinAnsiEncoding'):
|
||||
#https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDF32000_2008.pdf page 255
|
||||
pdfFont.Encoding = e
|
||||
|
||||
# is it a built-in one? if not, need more stuff.
|
||||
if not self.face.name in standardFonts:
|
||||
pdfFont.FirstChar = 0
|
||||
pdfFont.LastChar = 255
|
||||
pdfFont.Widths = pdfdoc.PDFArray(self.widths)
|
||||
pdfFont.FontDescriptor = self.face.addObjects(doc)
|
||||
# now link it in
|
||||
ref = doc.Reference(pdfFont, internalName)
|
||||
|
||||
# also refer to it in the BasicFonts dictionary
|
||||
fontDict = doc.idToObject['BasicFonts'].dict
|
||||
fontDict[internalName] = pdfFont
|
||||
|
||||
# and in the font mappings
|
||||
doc.fontMapping[self.fontName] = '/' + internalName
|
||||
|
||||
PFB_MARKER=chr(0x80)
|
||||
PFB_ASCII=chr(1)
|
||||
PFB_BINARY=chr(2)
|
||||
PFB_EOF=chr(3)
|
||||
|
||||
def _pfbCheck(p,d,m,fn):
|
||||
if chr(d[p])!=PFB_MARKER or chr(d[p+1])!=m:
|
||||
raise ValueError('Bad pfb file\'%s\' expected chr(%d)chr(%d) at char %d, got chr(%d)chr(%d)' % (fn,ord(PFB_MARKER),ord(m),p,d[p],d[p+1]))
|
||||
if m==PFB_EOF: return
|
||||
p = p + 2
|
||||
l = (((((d[p+3])<<8)|(d[p+2])<<8)|(d[p+1]))<<8)|(d[p])
|
||||
p = p + 4
|
||||
if p+l>len(d):
|
||||
raise ValueError('Bad pfb file\'%s\' needed %d+%d bytes have only %d!' % (fn,p,l,len(d)))
|
||||
return p, p+l
|
||||
|
||||
_postScriptNames2Unicode = None
|
||||
class EmbeddedType1Face(TypeFace):
|
||||
"""A Type 1 font other than one of the basic 14.
|
||||
|
||||
Its glyph data will be embedded in the PDF file."""
|
||||
def __init__(self, afmFileName, pfbFileName):
|
||||
# ignore afm file for now
|
||||
TypeFace.__init__(self, None)
|
||||
#None is a hack, name will be supplied by AFM parse lower done
|
||||
#in this __init__ method.
|
||||
afmFileName = findInPaths(afmFileName,T1SearchPath)
|
||||
pfbFileName = findInPaths(pfbFileName,T1SearchPath)
|
||||
self.afmFileName = os.path.abspath(afmFileName)
|
||||
self.pfbFileName = os.path.abspath(pfbFileName)
|
||||
self.requiredEncoding = None
|
||||
self._loadGlyphs(pfbFileName)
|
||||
self._loadMetrics(afmFileName)
|
||||
|
||||
def getFontFiles(self):
|
||||
return [self.afmFileName, self.pfbFileName]
|
||||
|
||||
def _loadGlyphs(self, pfbFileName):
|
||||
"""Loads in binary glyph data, and finds the four length
|
||||
measurements needed for the font descriptor"""
|
||||
pfbFileName = bruteForceSearchForFile(pfbFileName)
|
||||
assert rl_isfile(pfbFileName), 'file %s not found' % pfbFileName
|
||||
d = open_and_read(pfbFileName, 'b')
|
||||
s1, l1 = _pfbCheck(0,d,PFB_ASCII,pfbFileName)
|
||||
s2, l2 = _pfbCheck(l1,d,PFB_BINARY,pfbFileName)
|
||||
s3, l3 = _pfbCheck(l2,d,PFB_ASCII,pfbFileName)
|
||||
_pfbCheck(l3,d,PFB_EOF,pfbFileName)
|
||||
self._binaryData = d[s1:l1]+d[s2:l2]+d[s3:l3]
|
||||
|
||||
self._length = len(self._binaryData)
|
||||
self._length1 = l1-s1
|
||||
self._length2 = l2-s2
|
||||
self._length3 = l3-s3
|
||||
|
||||
|
||||
def _loadMetrics(self, afmFileName):
|
||||
"""Loads in and parses font metrics"""
|
||||
#assert os.path.isfile(afmFileName), "AFM file %s not found" % afmFileName
|
||||
afmFileName = bruteForceSearchForFile(afmFileName)
|
||||
(topLevel, glyphData) = parseAFMFile(afmFileName)
|
||||
|
||||
self.name = topLevel['FontName']
|
||||
self.familyName = topLevel['FamilyName']
|
||||
self.ascent = topLevel.get('Ascender', 1000)
|
||||
self.descent = topLevel.get('Descender', 0)
|
||||
self.capHeight = topLevel.get('CapHeight', 1000)
|
||||
self.italicAngle = topLevel.get('ItalicAngle', 0)
|
||||
self.stemV = topLevel.get('stemV', 0)
|
||||
self.xHeight = topLevel.get('XHeight', 1000)
|
||||
|
||||
strBbox = topLevel.get('FontBBox', [0,0,1000,1000])
|
||||
tokens = strBbox.split()
|
||||
self.bbox = []
|
||||
for tok in tokens:
|
||||
self.bbox.append(int(tok))
|
||||
|
||||
glyphWidths = {}
|
||||
for (cid, width, name) in glyphData:
|
||||
glyphWidths[name] = width
|
||||
self.glyphWidths = glyphWidths
|
||||
self.glyphNames = list(glyphWidths.keys())
|
||||
self.glyphNames.sort()
|
||||
|
||||
# for font-specific encodings like Symbol, Dingbats, Carta we
|
||||
# need to make a new encoding as well....
|
||||
if topLevel.get('EncodingScheme', None) == 'FontSpecific':
|
||||
global _postScriptNames2Unicode
|
||||
if _postScriptNames2Unicode is None:
|
||||
try:
|
||||
from reportlab.pdfbase._glyphlist import _glyphname2unicode
|
||||
_postScriptNames2Unicode = _glyphname2unicode
|
||||
del _glyphname2unicode
|
||||
except:
|
||||
_postScriptNames2Unicode = {}
|
||||
raise ValueError(
|
||||
"cannot import module reportlab.pdfbase._glyphlist module\n"
|
||||
"you can obtain a version from here\n"
|
||||
"https://www.reportlab.com/ftp/_glyphlist.py\n"
|
||||
)
|
||||
|
||||
names = [None] * 256
|
||||
ex = {}
|
||||
rex = {}
|
||||
for (code, width, name) in glyphData:
|
||||
if 0<=code<=255:
|
||||
names[code] = name
|
||||
u = _postScriptNames2Unicode.get(name,None)
|
||||
if u is not None:
|
||||
rex[code] = u
|
||||
ex[u] = code
|
||||
encName = encodings.normalize_encoding('rl-dynamic-%s-encoding' % self.name)
|
||||
rl_codecs.RL_Codecs.add_dynamic_codec(encName,ex,rex)
|
||||
self.requiredEncoding = encName
|
||||
enc = Encoding(encName, names)
|
||||
registerEncoding(enc)
|
||||
|
||||
def addObjects(self, doc):
|
||||
"""Add whatever needed to PDF file, and return a FontDescriptor reference"""
|
||||
from reportlab.pdfbase import pdfdoc
|
||||
|
||||
fontFile = pdfdoc.PDFStream()
|
||||
fontFile.content = self._binaryData
|
||||
#fontFile.dictionary['Length'] = self._length
|
||||
fontFile.dictionary['Length1'] = self._length1
|
||||
fontFile.dictionary['Length2'] = self._length2
|
||||
fontFile.dictionary['Length3'] = self._length3
|
||||
#fontFile.filters = [pdfdoc.PDFZCompress]
|
||||
|
||||
fontFileRef = doc.Reference(fontFile, 'fontFile:' + self.pfbFileName)
|
||||
|
||||
fontDescriptor = pdfdoc.PDFDictionary({
|
||||
'Type': '/FontDescriptor',
|
||||
'Ascent':self.ascent,
|
||||
'CapHeight':self.capHeight,
|
||||
'Descent':self.descent,
|
||||
'Flags': 34,
|
||||
'FontBBox':pdfdoc.PDFArray(self.bbox),
|
||||
'FontName':pdfdoc.PDFName(self.name),
|
||||
'ItalicAngle':self.italicAngle,
|
||||
'StemV':self.stemV,
|
||||
'XHeight':self.xHeight,
|
||||
'FontFile': fontFileRef,
|
||||
})
|
||||
fontDescriptorRef = doc.Reference(fontDescriptor, 'fontDescriptor:' + self.name)
|
||||
return fontDescriptorRef
|
||||
|
||||
def registerTypeFace(face):
|
||||
assert isinstance(face, TypeFace), 'Not a TypeFace: %s' % face
|
||||
_typefaces[face.name] = face
|
||||
if not face.name in standardFonts:
|
||||
# HACK - bold/italic do not apply for type 1, so egister
|
||||
# all combinations of mappings.
|
||||
registerFontFamily(face.name)
|
||||
|
||||
def registerEncoding(enc):
|
||||
assert isinstance(enc, Encoding), 'Not an Encoding: %s' % enc
|
||||
if enc.name in _encodings:
|
||||
# already got one, complain if they are not the same
|
||||
if enc.isEqual(_encodings[enc.name]):
|
||||
enc.freeze()
|
||||
else:
|
||||
raise FontError('Encoding "%s" already registered with a different name vector!' % enc.name)
|
||||
else:
|
||||
_encodings[enc.name] = enc
|
||||
enc.freeze()
|
||||
# have not yet dealt with immutability!
|
||||
|
||||
def registerFontFamily(family,normal=None,bold=None,italic=None,boldItalic=None):
|
||||
from reportlab.lib import fonts
|
||||
if not normal: normal = family
|
||||
family = family.lower()
|
||||
if not boldItalic: boldItalic = italic or bold or normal
|
||||
if not bold: bold = normal
|
||||
if not italic: italic = normal
|
||||
fonts.addMapping(family, 0, 0, normal)
|
||||
fonts.addMapping(family, 1, 0, bold)
|
||||
fonts.addMapping(family, 0, 1, italic)
|
||||
fonts.addMapping(family, 1, 1, boldItalic)
|
||||
|
||||
def registerFont(font):
|
||||
"Registers a font, including setting up info for accelerated stringWidth"
|
||||
#assert isinstance(font, Font), 'Not a Font: %s' % font
|
||||
fontName = font.fontName
|
||||
if font._dynamicFont:
|
||||
faceName = font.face.name
|
||||
if fontName not in _fonts:
|
||||
if faceName in _dynFaceNames:
|
||||
ofont = _dynFaceNames[faceName]
|
||||
if not ofont._dynamicFont:
|
||||
raise ValueError('Attempt to register fonts %r %r for face %r' % (ofont, font, faceName))
|
||||
else:
|
||||
_fonts[fontName] = ofont
|
||||
else:
|
||||
_dynFaceNames[faceName] = _fonts[fontName] = font
|
||||
else:
|
||||
_fonts[fontName] = font
|
||||
|
||||
if font._multiByte:
|
||||
# CID fonts don't need to have typeface registered.
|
||||
#need to set mappings so it can go in a paragraph even if within
|
||||
# bold tags
|
||||
registerFontFamily(font.fontName)
|
||||
|
||||
def getTypeFace(faceName):
|
||||
"""Lazily construct known typefaces if not found"""
|
||||
try:
|
||||
return _typefaces[faceName]
|
||||
except KeyError:
|
||||
# not found, construct it if known
|
||||
if faceName in standardFonts:
|
||||
face = TypeFace(faceName)
|
||||
(face.familyName, face.bold, face.italic) = _fontdata.standardFontAttributes[faceName]
|
||||
registerTypeFace(face)
|
||||
## print 'auto-constructing type face %s with family=%s, bold=%d, italic=%d' % (
|
||||
## face.name, face.familyName, face.bold, face.italic)
|
||||
return face
|
||||
else:
|
||||
#try a brute force search
|
||||
afm = bruteForceSearchForAFM(faceName)
|
||||
if afm:
|
||||
for e in ('.pfb', '.PFB'):
|
||||
pfb = os.path.splitext(afm)[0] + e
|
||||
if rl_isfile(pfb): break
|
||||
assert rl_isfile(pfb), 'file %s not found!' % pfb
|
||||
face = EmbeddedType1Face(afm, pfb)
|
||||
registerTypeFace(face)
|
||||
return face
|
||||
else:
|
||||
raise
|
||||
|
||||
def getEncoding(encName):
|
||||
"""Lazily construct known encodings if not found"""
|
||||
try:
|
||||
return _encodings[encName]
|
||||
except KeyError:
|
||||
if encName in standardEncodings:
|
||||
enc = Encoding(encName)
|
||||
registerEncoding(enc)
|
||||
#print 'auto-constructing encoding %s' % encName
|
||||
return enc
|
||||
else:
|
||||
raise
|
||||
|
||||
def findFontAndRegister(fontName):
|
||||
'''search for and register a font given its name'''
|
||||
fontName = str(fontName)
|
||||
assert type(fontName) is str, 'fontName=%s is not required type str' % ascii(fontName)
|
||||
#it might have a font-specific encoding e.g. Symbol
|
||||
# or Dingbats. If not, take the default.
|
||||
face = getTypeFace(fontName)
|
||||
if face.requiredEncoding:
|
||||
font = Font(fontName, fontName, face.requiredEncoding)
|
||||
else:
|
||||
font = Font(fontName, fontName, defaultEncoding)
|
||||
registerFont(font)
|
||||
return font
|
||||
|
||||
def getFont(fontName):
|
||||
"""Lazily constructs known fonts if not found.
|
||||
|
||||
Names of form 'face-encoding' will be built if
|
||||
face and encoding are known. Also if the name is
|
||||
just one of the standard 14, it will make up a font
|
||||
in the default encoding."""
|
||||
try:
|
||||
return _fonts[fontName]
|
||||
except KeyError:
|
||||
return findFontAndRegister(fontName)
|
||||
|
||||
_notdefFont = getFont('ZapfDingbats')
|
||||
standardT1SubstitutionFonts.extend([getFont('Symbol'),_notdefFont])
|
||||
|
||||
def getAscentDescent(fontName,fontSize=None):
|
||||
font = getFont(fontName)
|
||||
try:
|
||||
ascent = font.ascent
|
||||
descent = font.descent
|
||||
except:
|
||||
ascent = font.face.ascent
|
||||
descent = font.face.descent
|
||||
if fontSize:
|
||||
norm = fontSize/1000.
|
||||
return ascent*norm, descent*norm
|
||||
else:
|
||||
return ascent, descent
|
||||
|
||||
def getAscent(fontName,fontSize=None):
|
||||
return getAscentDescent(fontName,fontSize)[0]
|
||||
|
||||
def getDescent(fontName,fontSize=None):
|
||||
return getAscentDescent(fontName,fontSize)[1]
|
||||
|
||||
def getRegisteredFontNames():
|
||||
"Returns what's in there"
|
||||
reg = list(_fonts.keys())
|
||||
reg.sort()
|
||||
return reg
|
||||
|
||||
def stringWidth(text, fontName, fontSize, encoding='utf8'):
|
||||
"""Compute width of string in points;
|
||||
not accelerated as fast enough because of instanceStringWidthT1/TTF"""
|
||||
return getFont(fontName).stringWidth(text, fontSize, encoding=encoding)
|
||||
|
||||
def dumpFontData():
|
||||
print('Registered Encodings:')
|
||||
keys = list(_encodings.keys())
|
||||
keys.sort()
|
||||
for encName in keys:
|
||||
print(' ',encName)
|
||||
|
||||
print()
|
||||
print('Registered Typefaces:')
|
||||
faces = list(_typefaces.keys())
|
||||
faces.sort()
|
||||
for faceName in faces:
|
||||
print(' ',faceName)
|
||||
|
||||
|
||||
print()
|
||||
print('Registered Fonts:')
|
||||
k = list(_fonts.keys())
|
||||
k.sort()
|
||||
for key in k:
|
||||
font = _fonts[key]
|
||||
print(' %s (%s/%s)' % (font.fontName, font.face.name, font.encoding.name))
|
||||
|
||||
def test3widths(texts):
|
||||
# checks all 3 algorithms give same answer, note speed
|
||||
import time
|
||||
for fontName in standardFonts[0:1]:
|
||||
## t0 = time.time()
|
||||
## for text in texts:
|
||||
## l1 = stringWidth(text, fontName, 10)
|
||||
## t1 = time.time()
|
||||
## print 'fast stringWidth took %0.4f' % (t1 - t0)
|
||||
|
||||
t0 = time.time()
|
||||
w = getFont(fontName).widths
|
||||
for text in texts:
|
||||
l2 = 0
|
||||
for ch in text:
|
||||
l2 = l2 + w[ord(ch)]
|
||||
t1 = time.time()
|
||||
print('slow stringWidth took %0.4f' % (t1 - t0))
|
||||
|
||||
t0 = time.time()
|
||||
for text in texts:
|
||||
l3 = getFont(fontName).stringWidth(text, 10)
|
||||
t1 = time.time()
|
||||
print('class lookup and stringWidth took %0.4f' % (t1 - t0))
|
||||
print()
|
||||
|
||||
def testStringWidthAlgorithms():
|
||||
rawdata = open('../../rlextra/rml2pdf/doc/rml_user_guide.prep').read()
|
||||
print('rawdata length %d' % len(rawdata))
|
||||
print('test one huge string...')
|
||||
test3widths([rawdata])
|
||||
print()
|
||||
words = rawdata.split()
|
||||
print('test %d shorter strings (average length %0.2f chars)...' % (len(words), 1.0*len(rawdata)/len(words)))
|
||||
test3widths(words)
|
||||
|
||||
|
||||
def test():
|
||||
helv = TypeFace('Helvetica')
|
||||
registerTypeFace(helv)
|
||||
print(helv.glyphNames[0:30])
|
||||
|
||||
wombat = TypeFace('Wombat')
|
||||
print(wombat.glyphNames)
|
||||
registerTypeFace(wombat)
|
||||
|
||||
dumpFontData()
|
||||
|
||||
#preserve the initial values here
|
||||
def _reset(
|
||||
initial_dicts = dict(
|
||||
_typefaces = _typefaces.copy(),
|
||||
_encodings = _encodings.copy(),
|
||||
_fonts = _fonts.copy(),
|
||||
_dynFaceNames = _dynFaceNames.copy(),
|
||||
)
|
||||
):
|
||||
for k,v in initial_dicts.items():
|
||||
d=globals()[k]
|
||||
d.clear()
|
||||
d.update(v)
|
||||
rl_codecs.RL_Codecs.reset_dynamic_codecs()
|
||||
|
||||
from reportlab.rl_config import register_reset
|
||||
register_reset(_reset)
|
||||
del register_reset
|
||||
|
||||
if __name__=='__main__':
|
||||
test()
|
||||
testStringWidthAlgorithms()
|
||||
@@ -0,0 +1,93 @@
|
||||
__doc__="""helper for importing pdf structures into a ReportLab generated document
|
||||
"""
|
||||
from reportlab.pdfbase.pdfdoc import format, PDFObject, pdfdocEnc
|
||||
from reportlab.lib.utils import strTypes
|
||||
|
||||
def _patternSequenceCheck(pattern_sequence):
|
||||
allowedTypes = strTypes if isinstance(strTypes, tuple) else (strTypes,)
|
||||
allowedTypes = allowedTypes + (PDFObject,PDFPatternIf)
|
||||
for x in pattern_sequence:
|
||||
if not isinstance(x,allowedTypes):
|
||||
if len(x)!=1:
|
||||
raise ValueError("sequence elts must be strings/bytes/PDFPatternIfs or singletons containing strings: "+ascii(x))
|
||||
if not isinstance(x[0],strTypes):
|
||||
raise ValueError("Singletons must contain strings/bytes or PDFObject instances only: "+ascii(x[0]))
|
||||
|
||||
class PDFPattern(PDFObject):
|
||||
__RefOnly__ = 1
|
||||
def __init__(self, pattern_sequence, **keywordargs):
|
||||
"""
|
||||
Description of a kind of PDF object using a pattern.
|
||||
|
||||
Pattern sequence should contain strings, singletons of form [string] or
|
||||
PDFPatternIf objects.
|
||||
Strings are literal strings to be used in the object.
|
||||
Singletons are names of keyword arguments to include.
|
||||
PDFpatternIf objects allow some conditionality.
|
||||
Keyword arguments can be non-instances which are substituted directly in string conversion,
|
||||
or they can be object instances in which case they should be pdfdoc.* style
|
||||
objects with a x.format(doc) method.
|
||||
Keyword arguments may be set on initialization or subsequently using __setitem__, before format.
|
||||
"constant object" instances can also be inserted in the patterns.
|
||||
"""
|
||||
_patternSequenceCheck(pattern_sequence)
|
||||
self.pattern = pattern_sequence
|
||||
self.arguments = keywordargs
|
||||
|
||||
def __setitem__(self, item, value):
|
||||
self.arguments[item] = value
|
||||
|
||||
def __getitem__(self, item):
|
||||
return self.arguments[item]
|
||||
|
||||
def eval(self,L):
|
||||
arguments = self.arguments
|
||||
document = self.__document
|
||||
for x in L:
|
||||
if isinstance(x,strTypes):
|
||||
yield pdfdocEnc(x)
|
||||
elif isinstance(x,PDFObject):
|
||||
yield x.format(document)
|
||||
elif isinstance(x,PDFPatternIf):
|
||||
result = list(self.eval(x.cond))
|
||||
cond = result and result[0]
|
||||
for z in self.eval(x.thenPart if cond else x.elsePart):
|
||||
yield z
|
||||
else:
|
||||
name = x[0]
|
||||
value = arguments.get(name, None)
|
||||
if value is None:
|
||||
raise ValueError("%s value not defined" % ascii(name))
|
||||
if isinstance(value,PDFObject):
|
||||
yield format(value,document)
|
||||
elif isinstance(value,strTypes):
|
||||
yield pdfdocEnc(value)
|
||||
else:
|
||||
yield pdfdocEnc(str(value))
|
||||
|
||||
def format(self, document):
|
||||
self.__document = document
|
||||
try:
|
||||
return b"".join(self.eval(self.pattern))
|
||||
finally:
|
||||
del self.__document
|
||||
|
||||
def clone(self):
|
||||
c = object.__new__(self.__class__)
|
||||
c.pattern = self.pattern
|
||||
c.arguments = self.arguments
|
||||
return c
|
||||
|
||||
class PDFPatternIf:
|
||||
'''cond will be evaluated as [cond] in PDFpattern eval.
|
||||
It should evaluate to a list with value 0/1 etc etc.
|
||||
thenPart is a list to be evaluated if the cond evaulates true,
|
||||
elsePart is the false sequence.
|
||||
'''
|
||||
def __init__(self,cond,thenPart=[],elsePart=[]):
|
||||
if not isinstance(cond,list): cond = [cond]
|
||||
for x in cond, thenPart, elsePart:
|
||||
_patternSequenceCheck(x)
|
||||
self.cond = cond
|
||||
self.thenPart = thenPart
|
||||
self.elsePart = elsePart
|
||||
@@ -0,0 +1,298 @@
|
||||
#Copyright ReportLab Europe Ltd. 2000-2017
|
||||
#see license.txt for license details
|
||||
#history https://hg.reportlab.com/hg-public/reportlab/log/tip/src/reportlab/pdfbase/pdfutils.py
|
||||
__version__='3.3.0'
|
||||
__doc__=''
|
||||
# pdfutils.py - everything to do with images, streams,
|
||||
# compression, and some constants
|
||||
|
||||
import os
|
||||
import binascii
|
||||
from io import BytesIO
|
||||
|
||||
from reportlab import rl_config
|
||||
from reportlab.lib.utils import ImageReader, isUnicode
|
||||
from reportlab.lib.rl_accel import asciiBase85Encode, asciiBase85Decode
|
||||
|
||||
def _chunker(src,dst=[],chunkSize=60):
|
||||
for i in range(0,len(src),chunkSize):
|
||||
dst.append(src[i:i+chunkSize])
|
||||
return dst
|
||||
|
||||
##########################################################
|
||||
#
|
||||
# Image compression helpers. Preprocessing a directory
|
||||
# of images will offer a vast speedup.
|
||||
#
|
||||
##########################################################
|
||||
_mode2cs = {'RGB':'RGB', 'CMYK': 'CMYK', 'L': 'G'}
|
||||
_mode2bpp = {'RGB': 3, 'CMYK':4, 'L':1}
|
||||
def makeA85Image(filename,IMG=None, detectJpeg=False):
|
||||
import zlib
|
||||
img = ImageReader(filename)
|
||||
if IMG is not None:
|
||||
IMG.append(img)
|
||||
if detectJpeg and img.jpeg_fh():
|
||||
return None
|
||||
|
||||
imgwidth, imgheight = img.getSize()
|
||||
raw = img.getRGBData()
|
||||
|
||||
code = []
|
||||
append = code.append
|
||||
# this describes what is in the image itself
|
||||
append('BI')
|
||||
append('/W %s /H %s /BPC 8 /CS /%s /F [/A85 /Fl]' % (imgwidth, imgheight,_mode2cs[img.mode]))
|
||||
append('ID')
|
||||
#use a flate filter and Ascii Base 85
|
||||
assert len(raw) == imgwidth * imgheight*_mode2bpp[img.mode], "Wrong amount of data for image"
|
||||
compressed = zlib.compress(raw) #this bit is very fast...
|
||||
encoded = asciiBase85Encode(compressed) #...sadly this may not be
|
||||
|
||||
#append in blocks of 60 characters
|
||||
_chunker(encoded,code)
|
||||
|
||||
append('EI')
|
||||
return code
|
||||
def makeRawImage(filename,IMG=None,detectJpeg=False):
|
||||
import zlib
|
||||
img = ImageReader(filename)
|
||||
if IMG is not None:
|
||||
IMG.append(img)
|
||||
if detectJpeg and img.jpeg_fh():
|
||||
return None
|
||||
|
||||
imgwidth, imgheight = img.getSize()
|
||||
raw = img.getRGBData()
|
||||
|
||||
code = []
|
||||
append = code.append
|
||||
# this describes what is in the image itself
|
||||
append('BI')
|
||||
append('/W %s /H %s /BPC 8 /CS /%s /F [/Fl]' % (imgwidth, imgheight,_mode2cs[img.mode]))
|
||||
append('ID')
|
||||
#use a flate filter
|
||||
assert len(raw) == imgwidth * imgheight*_mode2bpp[img.mode], "Wrong amount of data for image"
|
||||
compressed = zlib.compress(raw) #this bit is very fast...
|
||||
|
||||
#append in blocks of 60 characters
|
||||
_chunker(compressed,code)
|
||||
|
||||
append('EI')
|
||||
return code
|
||||
|
||||
def cacheImageFile(filename, returnInMemory=0, IMG=None):
|
||||
"Processes image as if for encoding, saves to a file with .a85 extension."
|
||||
|
||||
cachedname = os.path.splitext(filename)[0] + (rl_config.useA85 and '.a85' or '.bin')
|
||||
if filename==cachedname:
|
||||
if cachedImageExists(filename):
|
||||
from reportlab.lib.utils import open_for_read
|
||||
if returnInMemory: return filter(None,open_for_read(cachedname).read().split('\r\n'))
|
||||
else:
|
||||
raise IOError('No such cached image %s' % filename)
|
||||
else:
|
||||
if rl_config.useA85:
|
||||
code = makeA85Image(filename,IMG)
|
||||
else:
|
||||
code = makeRawImage(filename,IMG)
|
||||
if returnInMemory: return code
|
||||
|
||||
#save it to a file
|
||||
f = open(cachedname,'wb')
|
||||
f.write('\r\n'.join(code)+'\r\n')
|
||||
f.close()
|
||||
if rl_config.verbose:
|
||||
print('cached image as %s' % cachedname)
|
||||
|
||||
|
||||
def preProcessImages(spec):
|
||||
"""Preprocesses one or more image files.
|
||||
|
||||
Accepts either a filespec ('C:\\mydir\\*.jpg') or a list
|
||||
of image filenames, crunches them all to save time. Run this
|
||||
to save huge amounts of time when repeatedly building image
|
||||
documents."""
|
||||
|
||||
import glob
|
||||
|
||||
if isinstance(spec,str):
|
||||
filelist = glob.glob(spec)
|
||||
else: #list or tuple OK
|
||||
filelist = spec
|
||||
|
||||
for filename in filelist:
|
||||
if cachedImageExists(filename):
|
||||
if rl_config.verbose:
|
||||
print('cached version of %s already exists' % filename)
|
||||
else:
|
||||
cacheImageFile(filename)
|
||||
|
||||
|
||||
def cachedImageExists(filename):
|
||||
"""Determines if a cached image already exists for a given file.
|
||||
|
||||
Determines if a cached image exists which has the same name
|
||||
and equal or newer date to the given file."""
|
||||
cachedname = os.path.splitext(filename)[0] + (rl_config.useA85 and '.a85' or 'bin')
|
||||
if os.path.isfile(cachedname):
|
||||
#see if it is newer
|
||||
original_date = os.stat(filename)[8]
|
||||
cached_date = os.stat(cachedname)[8]
|
||||
if original_date > cached_date:
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
##############################################################
|
||||
#
|
||||
# PDF Helper functions
|
||||
#
|
||||
##############################################################
|
||||
|
||||
def _normalizeLineEnds(text,desired='\r\n',unlikely='\x00\x01\x02\x03'):
|
||||
"""Normalizes different line end character(s).
|
||||
|
||||
Ensures all instances of CR, LF and CRLF end up as
|
||||
the specified one."""
|
||||
|
||||
return (text
|
||||
.replace('\r\n', unlikely)
|
||||
.replace('\r', unlikely)
|
||||
.replace('\n', unlikely)
|
||||
.replace(unlikely, desired))
|
||||
|
||||
def _AsciiHexEncode(input):
|
||||
"""Encodes input using ASCII-Hex coding.
|
||||
|
||||
This is a verbose encoding used for binary data within
|
||||
a PDF file. One byte binary becomes two bytes of ASCII.
|
||||
Helper function used by images."""
|
||||
if isUnicode(input):
|
||||
input = input.encode('utf-8')
|
||||
output = BytesIO()
|
||||
output.write(binascii.b2a_hex(input))
|
||||
output.write(b'>')
|
||||
return output.getvalue()
|
||||
|
||||
|
||||
def _AsciiHexDecode(input):
|
||||
"""Decodes input using ASCII-Hex coding.
|
||||
|
||||
Not used except to provide a test of the inverse function."""
|
||||
|
||||
#strip out all whitespace
|
||||
if not isUnicode(input):
|
||||
input = input.decode('utf-8')
|
||||
stripped = ''.join(input.split())
|
||||
assert stripped[-1] == '>', 'Invalid terminator for Ascii Hex Stream'
|
||||
stripped = stripped[:-1] #chop off terminator
|
||||
assert len(stripped) % 2 == 0, 'Ascii Hex stream has odd number of bytes'
|
||||
|
||||
return ''.join([chr(int(stripped[i:i+2],16)) for i in range(0,len(stripped),2)])
|
||||
|
||||
def _wrap(input, columns=60):
|
||||
"Wraps input at a given column size by inserting \r\n characters."
|
||||
output = []
|
||||
length = len(input)
|
||||
i = 0
|
||||
pos = columns * i
|
||||
while pos < length:
|
||||
output.append(input[pos:pos+columns])
|
||||
i = i + 1
|
||||
pos = columns * i
|
||||
#avoid HP printer problem
|
||||
if len(output[-1])==1:
|
||||
output[-2:] = [output[-2][:-1],output[-2][-1]+output[-1]]
|
||||
return '\r\n'.join(output)
|
||||
|
||||
|
||||
#########################################################################
|
||||
#
|
||||
# JPEG processing code - contributed by Eric Johnson
|
||||
#
|
||||
#########################################################################
|
||||
|
||||
# Read data from the JPEG file. We should probably be using PIL to
|
||||
# get this information for us -- but this way is more fun!
|
||||
# Returns (width, height, color components) as a triple
|
||||
# This is based on Thomas Merz's code from GhostScript (viewjpeg.ps)
|
||||
def readJPEGInfo(image):
|
||||
"Read width, height and number of components from open JPEG file."
|
||||
|
||||
import struct
|
||||
from reportlab.pdfbase.pdfdoc import PDFError
|
||||
|
||||
#Acceptable JPEG Markers:
|
||||
# SROF0=baseline, SOF1=extended sequential or SOF2=progressive
|
||||
validMarkers = [0xC0, 0xC1, 0xC2]
|
||||
|
||||
#JPEG markers without additional parameters
|
||||
noParamMarkers = \
|
||||
[ 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0x01 ]
|
||||
|
||||
#Unsupported JPEG Markers
|
||||
unsupportedMarkers = \
|
||||
[ 0xC3, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCD, 0xCE, 0xCF ]
|
||||
|
||||
#read JPEG marker segments until we find SOFn marker or EOF
|
||||
dpi = (72,72)
|
||||
done = 0
|
||||
while not done:
|
||||
x = struct.unpack('B', image.read(1))
|
||||
if x[0] == 0xFF: #found marker
|
||||
x = struct.unpack('B', image.read(1))
|
||||
#print('marker=%2x' % x[0])
|
||||
if x[0] in validMarkers:
|
||||
image.seek(2, 1) #skip segment length
|
||||
x = struct.unpack('B', image.read(1)) #data precision
|
||||
if x[0] != 8:
|
||||
raise PDFError('JPEG must have 8 bits per component')
|
||||
y = struct.unpack('BB', image.read(2))
|
||||
height = (y[0] << 8) + y[1]
|
||||
y = struct.unpack('BB', image.read(2))
|
||||
width = (y[0] << 8) + y[1]
|
||||
y = struct.unpack('B', image.read(1))
|
||||
color = y[0]
|
||||
return width, height, color, dpi
|
||||
elif x[0]==0xE0:
|
||||
x = struct.unpack('BB', image.read(2))
|
||||
n = (x[0] << 8) + x[1] - 2
|
||||
x = image.read(n)
|
||||
y = struct.unpack('BB', x[10:12])
|
||||
x = struct.unpack('BB', x[8:10])
|
||||
dpi = ((x[0]<<8) + x[1],(y[0]<<8)+y[1])
|
||||
elif x[0] in unsupportedMarkers:
|
||||
raise PDFError('JPEG Unsupported JPEG marker: %0.2x' % x[0])
|
||||
elif x[0] not in noParamMarkers:
|
||||
#skip segments with parameters
|
||||
#read length and skip the data
|
||||
x = struct.unpack('BB', image.read(2))
|
||||
image.seek( (x[0] << 8) + x[1] - 2, 1)
|
||||
|
||||
class _fusc:
|
||||
def __init__(self,k, n):
|
||||
assert k, 'Argument k should be a non empty string'
|
||||
self._k = k
|
||||
self._klen = len(k)
|
||||
self._n = int(n) or 7
|
||||
|
||||
def encrypt(self,s):
|
||||
return self.__rotate(asciiBase85Encode(''.join(map(chr,self.__fusc(list(map(ord,s)))))),self._n)
|
||||
|
||||
def decrypt(self,s):
|
||||
return ''.join(map(chr,self.__fusc(list(map(ord,asciiBase85Decode(self.__rotate(s,-self._n)))))))
|
||||
|
||||
def __rotate(self,s,n):
|
||||
l = len(s)
|
||||
if n<0: n = l+n
|
||||
n %= l
|
||||
if not n: return s
|
||||
return s[-n:]+s[:l-n]
|
||||
|
||||
def __fusc(self,s):
|
||||
slen = len(s)
|
||||
return list(map(lambda x,y: x ^ y,s,list(map(ord,((int(slen/self._klen)+1)*self._k)[:slen]))))
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user