[reportlab-users] renderPM erro

=?GB2312?B?wfXT2tbe?= yuzhouliu at eyou.com
Thu Feb 23 21:31:08 EST 2006


hi:
  I am chinece,so i user chinece Font.I user reportlab create
chinese font image.but i have a problem on Linux OS, win2000 no this
problem.
  My Reportlab version is 1.20,renderPM is 1.00,PIL is 1.1.5 and
Python24.  I write a python scripts file to create gif image
file,following:
from reportlab.graphics import renderPM
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
pdfmetrics.registerFont(TTFont('ºÚÌå', '/.../Fonts/simhei.ttf')) # which my fonts path,and simhei.ttf is exsit,I sure.

from reportlab.lib import colors
from reportlab.graphics.shapes import *
d = Drawing(400,200)
d.add(Rect(50,50,300,100, fillColor=colors.yellow))
unistring = unicode('ºÜºÃ','gb18030').encode('utf-8')
x=u'ÄãºÃ'
y='hello'
z=unistring+y
d.add(String(30,50,z,fontName='ºÚÌå'))
#renderPDF.drawToFile(d,'ww.pdf')
renderPM.drawToFile(d, 'out.gif', 'GIF')

when i run it,it erro to me:


Traceback (most recent call last):
  File "testx.py", line 20, in ?
    
renderPM.drawToFile(d, 'testx.gif', 'GIF')
  File 
"/lyz007/reportlab/graphics/renderPM.py", line 545, in drawToFile
    c = 
drawToPMCanvas(d, dpi=dpi, bg=bg, configPIL=configPIL, 
showBoundary=showBoundary)
  File "/lyz007/reportlab/graphics/renderPM.py", 
line 531, in drawToPMCanvas
    draw(d, c, 0, 0)
  File 
"/lyz007/reportlab/graphics/renderPM.py", line 50, in draw
    
R.draw(drawing, canvas, x, y)
  File 
"/lyz007/reportlab/graphics/renderPM.py", line 101, in draw
    
self.drawNode(drawing)
  File "/lyz007/reportlab/graphics/renderPM.py", line 
116, in drawNode
    self.drawNodeDispatcher(node)
  File 
"/lyz007/reportlab/graphics/renderbase.py", line 213, in 
drawNodeDispatcher
    self.drawGroup(node)
  File 
"/lyz007/reportlab/graphics/renderbase.py", line 237, in drawGroup
    
self.drawNode(node)
  File "/lyz007/reportlab/graphics/renderPM.py", line 
113, in drawNode
    self.push(node)
  File 
"/lyz007/reportlab/graphics/renderPM.py", line 68, in push
    
self.applyState()
  File "/lyz007/reportlab/graphics/renderPM.py", line 85, 
in applyState
    self._canvas.setFont(s['fontName'], s['fontSize'])
  
File "/lyz007/reportlab/graphics/renderPM.py", line 353, in setFont
    
_setFont(self._gs,fontName,fontSize)
  File 
"/lyz007/reportlab/graphics/renderPM.py", line 236, in _setFont
    raise 
RenderPMError, "Can't setFont(%s) missing the T1 files?\nOriginally %s: %s" % 
(fontName,s1,s2)
reportlab.graphics.renderPM.RenderPMError: Can't 
setFont(????) missing the T1 files?
Originally exceptions.AttributeError: 
TTFontFace instance has no attribute 'findT1File'


How can i do it now? thanks 




   






--Сö¦ÃÃÀ´É¹¼Òµ±À­
--http://freemail5.eyou.com/sys_sig.php?url=aHR0cDovL2V5b3VhZnAuYWxseWVzLmNvbS9tYWluL2FkZmNsaWNrP2RiPWV5b3VhZnAmYmlkPTk1LDgxLDMmY2lkPTczLDksMSZzaWQ9MTY4JmFkdmlkPTQmY2FtaWQ9NCZzaG93PWlnbm9yZSZ1cmw9aHR0cDovL2FkZmFybS5tZWRpYXBsZXguY29tL2FkL2NrLzQwODAtMjI5MDMtOTQ5OS0wP2FpZD1leW91O3RleHQ7MTAzJm1wcm89aHR0cDovL3NlYXJjaC5lYmF5LmNvbS5jbi9fVzBRUWNhdHJlZlpDNlFRZmNjbFoxUVFmY2xaM1FRZmxvY1oxUVFmcm9tWlIxMFFRZnNvb1oxUVFmc29wWjFRUWdhMTAyNDRaMTA0MjVRUXNhY2F0WlEyZDFRUXNhcHJjaGlaUVFzYXByY2xvWlFRc2FzbGNaMFFRc2F0aXRsZVpRZTVRYWVRYjZRZTVRYjFRODU=

--http://sms.eyou.com
--ÎÞÓǶþ¶þ×å¡¢×ãÇò´ó¸»ÎÌ...¾¡ÔÚÒÚÓʶÌÐÅ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://two.pairlist.net/pipermail/reportlab-users/attachments/20060224/eaaed51f/attachment.html


More information about the reportlab-users mailing list