[reportlab-users] behaviour change from 2.5 to 3.0 (or 3.3)
Robin Becker
robin at reportlab.com
Thu Jul 7 06:41:01 EDT 2016
On 06/07/2016 16:39, Yitzchak Scott-Thoennes wrote:
> I'm upgrading a server from ubuntu 12.04 (with reportlab 2.5) to 14.04
> (with reportlab 3.0) and seeing a difference I can't explain. I'd
> appreciate it if someone else could explain it.
> I'd even more appreciate suggestions for improvement.
>
> The following code results in "X test" horizontally aligned in 2.5 but
> puts the X a line below test in 3.0 or 3.3:
>
OK I think I solved this. In earlier versions of the code we were less exact
about handling long words and the measurements were not exactly right.
In old style the blPara.lines attribute constructed by breaklines looks like
[(-1.67, ['X'])]
in the modern world it looks like [(5.0, [u'']), (-1.67, [u'X'])]
your total line length (including the indent 5) is longer than the specified
column width. The new paragraph does the indent finds it cannot fit and then
throws a linefeed to allow the X to be placed OK.
The width of the X is actually 6.67 so it can never actually fit into the
allowed width of the lines in the Cell case (which is 10-5==5). However, the old
paragraphs never even tried to push/split words to the next line.
One could argue that we shouldn't actually throw the linefeed in this case. I
think the logic in the split words case may be slightly broken in the case when
no split is possible. If I fix that logic so we don't get the empty split then
the behaviour reverts to the old style in this special case.
You get credit for the bug report thanks :)
There will be a fixed package 3.3.14 available later today at
https://www.reportlab.com/pypi
you just need to sign up for a uid & password which you can get here
http://www.reportlab.com/accounts/register/
..........
--
Robin Becker
More information about the reportlab-users
mailing list