[reportlab-users] Re: rotated text (90?) in a table cell

Robin Becker robin at reportlab.com
Wed Oct 18 18:10:49 EDT 2006


Tim Roberts wrote:
> Paulino wrote:
> 
>> well now the script gives some errors:
>>
>> Traceback (most recent call last):
>>   File "D:/Python/reportlab/PPI_cabec.py", line 21, in wrap
>>     return canv._leading, canv.stringWidth(self.text)
>> TypeError: stringWidth() takes exactly 4 arguments (2 given)
>>
>> ......
>> I think the missing arguments should be aW, aH
>>
>> "return canv._leading, canv.stringWidth(self.text, aW, aH)"
>>  
>>
> 
> No.  A quick perusal of either the manual or the source code would have
> shown you that stringWidth expects the text, the fontname, and the fontsize.
> 
>     return canv._leading, canv.stringWidth( self.text, canv._fontname,
> canv._fontsize )
> 
> Given the fact that virtually all stringWidth calls use the current
> canvas font and size, I've never understood why the stringWidth method
> didn't default to those:
......
noted; even I thought it did the 'right' thing :(

-- 
Robin Becker


More information about the reportlab-users mailing list