[reportlab-users] question re: paragraph bounding box vertical offset

Chris Jerdonek chris.jerdonek at gmail.com
Mon Aug 30 12:20:54 EDT 2010


On Sun, Aug 29, 2010 at 10:59 AM, Chris Jerdonek
<chris.jerdonek at gmail.com> wrote:

> I've been doing some experiments, and it seems like a paragraph's

> bounding box is never flush with the text it contains.  It seems like

> the box is usually offset upwards a distance equal to a bit more than

> a third of the "leading" for lines in the paragraph (e.g. when the

> paragraph style has autoLeading='min').


A bit more info on this:

For fontSize = 24, it seems that setting borderPadding = (-7.5, 0,
7.5, 0) makes the paragraph text flush with its bounding box. I don't
know the significance of 7.5 relative to 24.

After digging into the code, I also found that changing
paraFontSizeHeightOffset in rl_config.py from its default of 1 to 0
makes the text flush. So I guess that is the right solution. I can't
explain the default behavior though.

--Chris


More information about the reportlab-users mailing list