[reportlab-users] Paragraph "Hack"

Robin Becker robin at reportlab.com
Tue Oct 21 05:14:19 EDT 2008

Paul Barrass wrote:


> cur_y = self.height - f.fontSize


> has become


> cur_y = self.height - getattr(f,'ascent',f.fontSize)

> #TODO fix XPreformatted to remove this hack


> Reversing this change returns the Paragraph to it's old behaviour, but

> I'm not sure what it breaks in XPreformatted.


> Has anybody else experienced this issue or know if my workaround won't

> lead to Bad Things happening?

The hack here was that when this change was first made we hadn't yet propagated
the ascent attribute to XPreformatteds so f.ascent could fail.

Probably we should be using the ascent here, but I'm not enough of a typographer
to say definitely. What you seem to be saying is that we should allow for
variable padding. We seem to draw the background around the paragraph as a
whole. I'm sure that makes sense in visual terms.
Robin Becker

More information about the reportlab-users mailing list