[reportlab-users] strange behaviour using symbols out of zapf dingbats

Harald Armin Massa haraldarminmassa at gmail.com
Wed Oct 24 07:50:53 EDT 2007


I am using chars of ZapfDingbats to have some symbols within PDFs, for example:

c.setFont('ZapfDingbats',14)
c.setFillColor(colors.green)
c.drawString(2.1*cm,15*cm,chr(226)+chr(150)+chr(160))
c.setFont('Helvetica-Bold',14)
c.setFillColor(colors.black)
c.drawString(3*cm,15*cm,doc.Formularname)

gives me a green square followed by a kind of headline.

(yes, using Platypus later on... but the behaviour does not need that)

NOW:
- on Screen the PDF looks good. The square is really a square
- printed out, from Acrobat Reader in a variety of versions and from
Foxit Reader, on a variety of printers with a variety of drivers and
different patch levels of Windows, the FIRST time the symbol gets
compressed.

That is: the first square is no more square, but only about 35% in
width. The same happens with other ZapfDingBats symbols, like

chr(226)+chr(156)+chr(141)
chr(226)+chr(158)+chr(165)

and allways, ONLY THE FIRST symbol ist compressed horizontally. "The
first" meaining the first in being put into the PDF, not "being at the
top by coordinates"


I have found a workaround, as I know which symbols will appear, I draw
them first in the upper left corner, with white colour.

def workaroundpdfbug(canv, listofcodes):
canv.setStrokeColor(colors.white)
canv.setFont('ZapfDingbats',14)
canv.setFillColor(colors.white)
for cd in listofcodes:
if cd:
canv.drawString(1*mm, hoehe-5*mm,cd)
canv.setStrokeColor(colors.black)
canv.setFillColor(colors.black)

--> drawing OUTSIDE the page does not solve the problem :(

but ... it's understandable that I am not that happy with this solution? :)

any idea what could be going wrong?

Harald

--
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Spielberger Straße 49
70435 Stuttgart
0173/9409607
fx 01212-5-13695179
-
EuroPython 2008 will take place in Vilnius, Lithuania - Stay tuned!


More information about the reportlab-users mailing list