[reportlab-users] Paragraph "Hack"

Paul Barrass paul.barrass at safeonlinebilling.com
Mon Oct 20 21:03:56 EDT 2008


Hi List,

After years of trouble-free use of ReportLab, I've come across a couple
of issues.

It appears that _rl_accel is no longer available as a "stand alone"
download - the daily snapshot seems to be missing some setup files
(setup.py being notable in it's absence). Is this the case, or have I
missed something?

I've upgraded to ReportLab 2.2, and I'm having visual problems with
Paragraphs. There is a border around the top of the text of the
paragraph in earlier versions (I was previously using 2.1), which is not
there in 2.2. I'm using Paragraphs with background colours and the text
is now touching the top of the box forming the background. I know there
is a 'borderWidth' attribute, but that gives an unsatisfactory result,
as the border is added to all four sides to the Paragraph, meaning it
becomes too wide and the border at the bottom is too large with any
sensible leading.

Looking to the source, I've found that

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?

Thanks,
Paul Barrass.


More information about the reportlab-users mailing list