[reportlab-users] Problem with canvas.saveState() canvas.restoreStae()

Charlie Clark reportlab-users@reportlab.com
Fri, 26 Mar 2004 19:49:31 +0100


I know it's mentioned in the handbook that this can cause problems but I 
can't see why the following should cause a problem

canvas.setFont("Arial", 8)
canvas.setState()
text = canvas.beginText(400, 10)
text.setCharSpace(2)
text.drawline("this is some text")
text.drawText(text)
canvas.restoreState()

This is giving me an error in the pop_stack for restoreState() which I 
don't understand - is it because the changes are to the textobject and not 
to the canvas? If so it possible to save and restore states on textobjects? 
or should I use text.setCharSpace(0) ?

While I'm at it - how is CharSpace calculated? I'm transposing from an 
existing system which uses "gevierts". My initial tests suggest that 1 = 
100 gevierts, more or less anyway.

Thanx

Charlie