[reportlab-users] [Solved] Rendering ZapfDingbats characters in Reportlab 2.3

Tony Rich aerich at fastmail.com.au
Thu Jul 15 06:40:15 EDT 2010


I've solved this problem !!

This post today from Robin Becker helped me do it:

-------------------------------------------------------------------------------
"Hi, my colleague Tim just ran the stdfonts.py demo which you can get here:"
https://svn.reportlab.com/svn/public/reportlab/trunk/demos/stdfonts/stdfonts.py
-------------------------------------------------------------------------------

So I tried the demo, took out the reference to "MacRoman" encoding because
python complained that this was an unknown encoding on my system (Ubuntu Linux
9.1), and produced the required ZapfDingbats characters.

Here is what had worked before, with python 2.5.2 and Reportlab 1.2:

Circle = char(0x6c) # Zapf solid circle (see pdf 1.4 reference)
...
...
Canvas.drawString(x, y, Circle) # draw solid circle

Here is what works now, with python 2.5.2 and Reportlab 2.3:

Circle = char(0x6c).decode("ZapfDingbatsEncoding","ignore").encode("utf8")
...
...
Canvas.drawString(x, y, Circle) # draw solid circle character

This works for all ZapfDungbats characters in the Adobe list.

Apparently the ZapfDingbats "own" encoding must be ignored, so this works.

Many thanks for the help !




More information about the reportlab-users mailing list