[reportlab-users] Multiple bugs in paragraph layout code when firstLineIndent set on paragraph's style

Brett Clouser brett at energysavvy.com
Wed Apr 20 16:30:47 EDT 2011

Hi all,

I've just recently started using ReportLab and really like it so far! I ran
into a couple of bugs in the paragraph layout code when I set
firstLineIndent on the Paragraph's style. When running the following
snippet, I received the output in foo.pdf (see attached):

style = ParagraphStyle('fooStyle')
style.firstLineIndent = 110
f = Frame(350, 575, 220, 60, topPadding=0, leftPadding=0, rightPadding=0,
bottomPadding=0, showBoundary=1)
p = Paragraph("Some really long text that won't necessarily fit on one line.
This could cause a problem.", style)
f.addFromList([p], c)

I believe I tracked down the problem to both the draw() and wrap() functions
in reportlab\platypus\para.py.

Line 1073: if not currentlength or nextlength<maxlength:
When attempting to determine if the line had become too wide, the maxlength
for the container was being used instead of 'thismaxlength'. The
'thismaxlength' variable was used to set maxlength depending on whether the
first line was being rendered or not.

Line 1154 in draw(): if first:
thisindent = firstindent
When rendering the lines, firstindent was always used since first is never
set to 0 after the first line has been drawn.

Is it possible to get a patch for these bugs released? I'm relatively new to
the process around this, so any guidance would be helpful.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20110420/f951150f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reportLabBug.py
Type: application/octet-stream
Size: 533 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20110420/f951150f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.pdf
Type: application/pdf
Size: 2049 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20110420/f951150f/attachment.pdf>

More information about the reportlab-users mailing list