[reportlab-users] Problem using FAQ example for embedding font
Gerry Reno
greno at verizon.net
Fri Sep 12 21:47:55 EDT 2008
I'm following the example for embedding fonts found here:
http://www.reportlab.org/devfaq.html#2.6.1
My module adds this code:
folder = os.path.join('addons','l10n_micr','fonts')
afmFile = os.path.join(folder, 'GnuMICR.afm')
pfbFile = os.path.join(folder, 'GnuMICR.pfb')
print 'debug: testing for existence of MICR font files...'
if os.path.exists(afmFile):
print 'afmFile = '+str(afmFile)
if os.path.exists(pfbFile):
print 'pfbFile = '+str(pfbFile)
justFace = pdfmetrics.EmbeddedType1Face(afmFile, pfbFile)
faceName = 'GnuMICR' # pulled from AFM file
pdfmetrics.registerTypeFace(justFace)
justFont = pdfmetrics.Font('GnuMICR', faceName, 'WinAnsiEncoding')
pdfmetrics.registerFont(justFont)
When I install this code I get this error:
testing for existence of MICR font files...
afmFile = addons/l10n_micr/fonts/GnuMICR.afm
pfbFile = addons/l10n_micr/fonts/GnuMICR.pfb
Fri, 12 Sep 2008 21:37:57 ERROR:web-services:Exception in call:
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/tinyerp-server/netsvc.py", line
317, in run
r=m(*msg[2:])
File
"/usr/lib/python2.5/site-packages/tinyerp-server/service/web_services.py",
line 422, in execute
return self._execute(db, uid, wiz_id, datas, action, context)
File
"/usr/lib/python2.5/site-packages/tinyerp-server/service/web_services.py",
line 402, in _execute
return wiz.execute(db, uid, self.wiz_datas[wiz_id], action, context)
File
"/usr/lib/python2.5/site-packages/tinyerp-server/wizard/__init__.py",
line 160, in execute
res = self.execute_cr(cr, uid, data, state, context)
File
"/usr/lib/python2.5/site-packages/tinyerp-server/wizard/__init__.py",
line 75, in execute_cr
action_res = action(self, cr, uid, data, context)
File
"/usr/lib/python2.5/site-packages/tinyerp-server/addons/base/module/wizard/wizard_update_module.py",
line 57, in _update_module
update, add =
pooler.get_pool(cr.dbname).get('ir.module.module').update_list(cr, uid)
File
"/usr/lib/python2.5/site-packages/tinyerp-server/addons/base/module/module.py",
line 388, in update_list
imp.load_module(name, *imp.find_module(mod_name))
File
"/usr/lib/python2.5/site-packages/tinyerp-server/addons/l10n_micr/__init__.py",
line 59, in <module>
*justFace = pdfmetrics.EmbeddedType1Face(afmFile,
pfbFile)
<=================== failing here*
File
"/usr/lib/python2.5/site-packages/reportlab/pdfbase/pdfmetrics.py", line
480, in __init__
self._loadMetrics(afmFileName)
File
"/usr/lib/python2.5/site-packages/reportlab/pdfbase/pdfmetrics.py", line
541, in _loadMetrics
registerEncoding(enc)
File
"/usr/lib/python2.5/site-packages/reportlab/pdfbase/pdfmetrics.py", line
593, in registerEncoding
raise FontError('Encoding "%s" already registered with a different
name vector!' % enc.Name)
AttributeError: Encoding instance has no attribute 'Name'
What does it mean? When I checked the pdfmetrics.py it looks like it is
intentionally setting the encoding to None. Does this make sense?
Thanks,
Gerry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20080912/836e4322/attachment.html>
More information about the reportlab-users
mailing list