[reportlab-users] Working out height of text

Jerome Alet reportlab-users@reportlab.com
Thu, 10 Apr 2003 15:59:19 +0200


On Thu, Apr 10, 2003 at 09:52:13AM -0400, Ian Sparks wrote:
> I need to work out the height of a line of text to find out if it will fit the box I'm writing it to (using raw canvas commands not Platypus).
> 
> >From somewhere I have the following function :
> 
> #self is a "font" class which has a fontname and a size e.g. "Helvetica",8
> h = pdfmetrics.TypeFace(self.fontname)
> self.textHeight = ((h.ascent - h.descent) * self.size) / 1000

See http://www.aful.org/wws/arc/python/2003-04/msg00016.html

it's in french tough

bye,

Jerome Alet