It looks like row spanning is not that difficult. What needs to be done
is to extend the meaning of "totalHeight" in Luca's algorithm for the
combined list. totalHeight will not only be the total height of a single
row, but of a row group. A row group in this context is the minimum
number of consecutive rows which contains all spanned grid units of its
cells. An example:

+----------+-------+----------+
|          |       |          |
+----------+-------+----------+
|          |                  |
|          |                  |
|          +-------+----------+
|          |       |          |
|          +-------+          |
|          |       |          |
+----------+-------+          |
|          |       |          |
+----------+-------+----------+

Here we'd have two such row groups, the first is equivalent to the first
row, the second contains rows 2 to 5. Note that we can't just sum up the
heights of the individual cells in the row group per column. We have to
add the space used by the cell borders (and optional cell spacing in
separate mode), too, because they are also elements that create steps in
the algorithm.

Handling stretch and shrink is still somewhat beyond me.

-----

A little goodie for those who want to see how the easiest case in Luca's
algorithm turns out:

Simplest example:

Table with one cell (three one-line blocks)
height = (3,3,3)
totalHeight = 3

Step1:
stepw = 1;
maxRemHeight = 2
penaltyHeight = 1 + 2 - 3 = 0;
boxHeight = 1 - 0 - 0 = 1
addedBoxHeight now 1

Step 2:
stepw = 1 + 1 = 2
maxRemHeight = 1
penaltyHeight = 2 + 1 - 3 = 0
boxHeight = 2 - 1 - 0 = 1
addedBoxHeight now 2

Step 3:
stepw = 2 + 1 = 3
maxRemHeight = 0
penaltyHeight = 3 + 0 - 3 = 0
boxHeight = 3 - 2 - 0 = 1
addedBoxHeight now 3

breaks:
1/2
2/1
3/0

box     1
penalty 0
box     1
penalty 0
box     1
(penalty 0)

On 29.03.2005 13:56:59 Luca Furini wrote:
> > A point I still have to think about for both approaches is how exactly
> > to handle row spanning, although I suspect it'll be easier for the first
> > approach.
> 
> I did not think about this yet, but I agree with you.



Jeremias Maerki

Reply via email to