[reportlab-users] bug in graphics/renderPDF.py

Volker Haas volker.haas at brainbot.com
Fri Sep 25 07:55:31 EDT 2009


When rendering a drawing with renderPDF.drawToFile() the font
"Times-Roman" is always reported as being used in the document. This is
a problem if all fonts need to be embedded in the PDF.

The problem is the hardcoded fontname "Times-Roman" instead of
rl_config.defaultGraphicsFontName.

The following patch solves the problem for me:

@@ -260 +260 @@ def drawToFile(d, fn, msg="",
showBoundary=rl_config._unset_, autoSize=1):
- c.setFont('Times-Roman', 36)
+ c.setFont(rl_config.defaultGraphicsFontName, 36)
@@ -269 +269 @@ def drawToFile(d, fn, msg="",
showBoundary=rl_config._unset_, autoSize=1):
- c.setFont('Times-Roman', 12)
+ c.setFont(rl_config.defaultGraphicsFontName, 12)

Attached is a minimal example that shows the problem (to make the
example work, the font location needs to be specified correctly...).

Regards,
Volker

--
volker haas brainbot technologies ag
fon +49 6131 2116394 boppstraße 64
fax +49 6131 2116392 55118 mainz
volker.haas at brainbot.com http://www.brainbot.com/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: drawing_test.py
Type: text/x-python
Size: 634 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20090925/6aac4588/attachment.py>


More information about the reportlab-users mailing list