[reportlab-users] bug with justified text?

Volker Haas volker.haas at brainbot.com
Wed Jan 21 10:27:59 EST 2009


Hi.

I might have found a bug related to justified text. The "bug" only
appears in a custom flowable I implemented, therefore I might be doing
something wrong. For that reason I can't easily supply a minimal example
just the diff of my "patch":

1 <http://hg/reportlab/rev/5cdf5f9cb2c5#l1> --- a/src/reportlab/platypus/paragraph.py Wed Jan 21 15:51:15 2009 +0100
2 <http://hg/reportlab/rev/5cdf5f9cb2c5#l2> +++ b/src/reportlab/platypus/paragraph.py Wed Jan 21 15:55:11 2009 +0100
3 <http://hg/reportlab/rev/5cdf5f9cb2c5#l3> @@ -322,7 +322,7 @@
4 <http://hg/reportlab/rev/5cdf5f9cb2c5#l4> setXPos(tx,offset)
5 <http://hg/reportlab/rev/5cdf5f9cb2c5#l5> extraSpace = line.extraSpace
6 <http://hg/reportlab/rev/5cdf5f9cb2c5#l6> nSpaces = line.wordCount - 1
7 <http://hg/reportlab/rev/5cdf5f9cb2c5#l7> - if last or not nSpaces or abs(extraSpace)<=1e-8 or line.lineBreak:
8 <http://hg/reportlab/rev/5cdf5f9cb2c5#l8> + if last or not nSpaces or abs(extraSpace)<=1e-8 or getattr(line, 'lineBreak', None):
9 <http://hg/reportlab/rev/5cdf5f9cb2c5#l9> _putFragLine(offset, tx, line) #no space modification
10 <http://hg/reportlab/rev/5cdf5f9cb2c5#l10> else:
11 <http://hg/reportlab/rev/5cdf5f9cb2c5#l11> tx.setWordSpace(extraSpace / float(nSpaces))


The last lines of the traceback without the patch are:

if last or not nSpaces or abs(extraSpace)<=1e-8 or line.lineBreak:
AttributeError: ParaLines instance has no attribute 'lineBreak'

That appens when calling the reportlab paragraph.draw method.

I hope this makes sense to anyone ;)

Regards,
Volker

--
volker haas brainbot technologies ag
fon +49 6131 2116394 boppstraße 64
fax +49 6131 2116392 55118 mainz
volker.haas at brainbot.com http://www.brainbot.com/



More information about the reportlab-users mailing list