You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by Apache Wiki <wi...@apache.org> on 2005/04/09 13:53:38 UTC

[Xmlgraphics-fop Wiki] Update of "TableLayout/KnuthElementsForTables/RowBorder" by SimonPepping

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Xmlgraphics-fop Wiki" for change notification.

The following page has been changed by SimonPepping:
http://wiki.apache.org/xmlgraphics-fop/TableLayout/KnuthElementsForTables/RowBorder

New page:
== Example with interaction between the row borders and the header and footer borders ==

This example explores what happens if the border of one of the rows has precedence over the header and footer borders.

{{{
<fo:table border="solid 5">
  <fo:table-header border="solid 4">
    <fo:table-row>
      <fo:table-cell line-height="8" border="solid 1" number-columns-spanned="2">
        <fo:block>HEADER</fo:block>
      </fo:table-cell>
    </fo:table-row>
  </fo:table-header>
  <fo:table-footer border="solid 4">
    <fo:table-row>
      <fo:table-cell line-height="8" border="solid 1" number-columns-spanned="2">
        <fo:block>FOOTER</fo:block>
      </fo:table-cell>
    </fo:table-row>
  </fo:table-footer>
  <fo:table-body border="solid 3">
    <fo:table-row border="solid 6">
      <fo:table-cell line-height="10" number-rows-spanned="2" border="solid 1">
        <fo:block>block1</fo:block>
        <fo:block>block2</fo:block>
        <fo:block>block3</fo:block>
      </fo:table-cell>
      <fo:table-cell line-height="15" border="solid 1">
        <fo:block>blockA</fo:block>
      </fo:table-cell>
    </fo:table-row>
    <fo:table-row>
      <fo:table-cell line-height="20" border="solid 1">
        <fo:block>blockB</fo:block>
      </fo:table-cell>
    </fo:table-row>
  </fo:table-body>
</fo:table>
}}}

An sketch of this example:

{{{
 no breaks  |   step 1   | step 2   | step 3   |  step 4
            |            |          |          |
     5      |      5     |    5     |    5     |     5
     8      |      8     |    8     |    8     |     8
    4+2     |     4+2    |   4+2    |   4+2    |    4+2
 10     15  | 10       - | 10    15 | 10    15 | 10     15
 10      6  |            |          | 10       | 10
 10     20  |            |          |          | 10
     4      |      4     |   4+2    |    4     |     4
     8      |      8     |    8     |    8     |     8
     5      |      5     |    5     |    5     |     5
----------------------------------------------------------- page break
            |      5     |    5     |    5     |     5
            |      8     |    8     |    8     |     8
            |     4+2    |    4     |    4     |     4
            |  10     15 | 10   20  | 10    20 |  -     20
            |  10      6 | 10       |          |
            |         20 |          |          |
            |      4     |    4     |    4     |     4
            |      8     |    8     |    8     |     8
            |      5     |    5     |    5     |     5
}}}

=== Normal borders (assuming no breaks) ===

{{{
Cell1
before: 6 (border-before row1 is dominant)
Candidates: border-after header cell, border-after header row, border-after header body, border-before cell1, border-before row1, border-before body
after: 4 (body border-before of table-footer is dominant)

Cell2:
before: 6 (border-before row1 is dominant)
after: 6 (row border is dominant)
Candidates: border after cell2, border-after row1, border before cell 3, border before row2

Cell3:
before: 6 (row border is dominant)
after: 4 (body border-before of table-footer is dominant)
}}}

We split the border after the header: 4 for the border-after of
table-header, which is there when it does not border on the first row;
this part is added to the penalties.  2 for the border-before row1;
this part is added to the total height and the steps.

=== Table header and footer width ===

{{{
Header is 5 + 8 = 13, border after = 4
Footer is 8 + 5 = 13, border before = 4
}}}

=== Row heights ===

{{{
row1: 2 (extra border height) + 15 + (6/2) => (20,20,20)
row2: 20 + (6/2) => (23,23,23)
row group (43,43,43)
}}}

=== Steps ===

{{{
Step 1:
stepw= 2 + 10
maxRemainingHeight = 43
addedBoxHeight = 0
penalty = 12 + 43 - 43 = 12
effPenalty: w = 12 (space for block1) + 13 (header) + 4 (border-after-header) + 4 (border-before-footer) + 13 (footer)
box = 12 - 0 - 12 = 0

Step 2:
stepw = 2 + 15 + 2
maxRemainingHeight = 20
addedBoxHeight = 0
penalty = 19 + 20 - 43 = -4
offPenalty: w = -4 (calc penalty) + 13 + 4 + 4 + 13
box = 19 - 0 - (-4) = 23

Step 3:
stepw = 2 + 10 + 10 = 22
maxRemainingHeight = 20
addedBoxHeight = 23
penalty = 22 + 20 - 43 = -1
effPenalty: w = -1 (calc penalty) + 13 + 4 + 4 + 13
box = 22 - 23 - (-1) = 0

Step 4:
stepw = 2 + 10 + 10 + 10 = 32
maxRemainingHeight = 20
addedBoxHeight = 23
penalty = 32 + 20 - 43 = 9
effPenalty: w = 9 (calc penalty) + 13 + 4 + 4 + 13
box = 32 - 23 - 9 = 0

Step 5:
stepw = 2 + 15 + 6 + 20 = 43
maxRemainingHeight = 0
addedBoxHeight = 23
penalty = 43 + 0 - 43 = 0 (last step, omit penalty)
box = 43 - 23 - 0 = 20
}}}

=== End result (with raw penalties) ===

{{{
box(0)
penalty(12) -> 12/43
box(23)
penalty(-4) -> 19/20
box(0)
penalty(-1) -> 22/20
box(0)
penalty(9)  -> 32/20
box(20)
            -> 43
}}}

=== End result (effective) ===

{{{
box(0)
penalty(46) //incl. header and footer -> 46/77
box(23)
penalty(30) //incl. header and footer -> 53/54
box(0)
penalty(33) //incl. header and footer -> 56/54
box(0)
penalty(43) //incl. header and footer -> 66/54
box(20)
box(17) //header
box(17) //footer
                                      -> 77
}}}

Step 3 also has a negative penalty, of -1 unit. This points to the
fact that the border after the block of 15 units, which is 6 units
high, extends 1 unit into the border before the footer. I am not sure
how this should be treated.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org