[reportlab-users] Multiple bugs in paragraph layout code when firstLineIndent set on paragraph's style
robin at reportlab.com
Thu Apr 21 04:44:53 EDT 2011
On 20/04/2011 21:30, Brett Clouser wrote:
> 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.
I'll take a look at this soon; your first step is correct reporting here will
normally fix up these simple bugs; if that's what this is it will be fixed.
More information about the reportlab-users