[reportlab-users] Miscalculation when using keepWithNext
ossman at cendio.se
Thu Nov 4 10:48:16 EDT 2021
On 04/11/2021 11:47, Robin Becker wrote:
> Hi Pierre,
> I think you are probably right in your analysis.
> 1) It's probably a bug to skip things that are zero width and non-zero
> height, It would be helpful to know what kind of flowable was involved
This is using rst2pdf via Sphinx. The conditions we encountered were a
bullet list followed by a heading and a paragraph. The sequence of
flowables rst2pdf generates in that case is:
The spacers have keepWithNext set to make sure that a heading before a
bullet list/table works properly. As a side effect the trailing spacer
here will be tied to the following heading. The heading also has
> 2) As you say it would be better to overestimate the required height,
> but best would be to compute correctly, but that requires us to check
> for inclusion in a frame and to work out what the extra height
> requirement is. Actually we can find out when we have a frame above us
> and inspect whether we are at the top of a frame and what if it would
> do at this point if we get added.
> The overall algorithm is badly designed, but it's probably far too late
> to adopt a better one.
How so? The handling of keepWithNext is mostly internal to ReportLab, so
it should be possibly to modify rather heavily without affecting users?
Pierre Ossman Software Development
Cendio AB https://cendio.com
Teknikringen 8 https://twitter.com/ThinLinc
583 30 Linköping https://facebook.com/ThinLinc
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
More information about the reportlab-users