Differences between revisions 2 and 3
Revision 2 as of 2008-08-13 08:51:55
Size: 2447
Comment: Fixed URL
Revision 3 as of 2009-09-20 23:52:48
Size: 2449
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 48: Line 48:
[http://people.apache.org/~jeremias/fop/KnuthElementsForTables.gif] [[http://people.apache.org/~jeremias/fop/KnuthElementsForTables.gif]]

Knuth Element Evaluation for page breaking

Table with headers and footers

The XSL-FO snippet

<fo:table border="solid 2pt red">
  <fo:table-header>
    <fo:table-row border="solid 4pt blue">
      <fo:table-cell>
        <fo:block>header</fo:block>
      </fo:table-cell>
    </fo:table-row>
  </fo:table-header>
  <fo:table-footer>
    <fo:table-row border="solid 4pt green">
      <fo:table-cell>
        <fo:block>footer</fo:block>
      </fo:table-cell>
    </fo:table-row>
  </fo:table-footer>
  <fo:table-body>
    <fo:table-row border="solid 1pt orange">
      <fo:table-cell>
        <fo:block>cell1</fo:block>
      </fo:table-cell>
      <fo:table-cell>
        <fo:block>cell2</fo:block>
      </fo:table-cell>
    </fo:table-row>
    <fo:table-row border="solid 1pt orange">
      <fo:table-cell>
        <fo:block>cell3a</fo:block>
        <fo:block>cell3b</fo:block>
      </fo:table-cell>
      <fo:table-cell>
        <fo:block>cell4a</fo:block>
        <fo:block>cell4b</fo:block>
      </fo:table-cell>
    </fo:table-row>
  </fo:table-body>
</fo:table>

the three possibilities

http://people.apache.org/~jeremias/fop/KnuthElementsForTables.gif

the result

  • box(header's half border-before, w=2pt)
  • box(header, w=14.4pt)
  • box(border between header and row1, w=4pt)
  • box(row1, w=14.4pt)
  • penalty(p=0, w=4pt+14.4pt+4pt=height of footer + border between row1 and footer + border-after of footer) [1]
  • glue(border between row1 and row2, w=1pt, y=z=0) [2]
  • box(row2 first line, w=14.4pt)
  • penalty(p=0, w=4pt+14.4pt+4pt=height of footer + border between row2 first line and footer + border-after of footer) [3]
  • box(row2 second line, w=14.4pt)
  • box(border between row2 and footer, w=4pt)
  • box(footer, w=14.4pt)
  • box(footers's half border-after, w=2pt)

After a page break cause by a special penalty, the elements for the table-header must be added as first elements on the new page. The elements for the next page must be recalculated anyway (because of potentially different available IPD). Unused elements after the breaking element must be discarded.

(Note: The above is under the assumption that a non-look-ahead page breaking algorithm is implemented.)

[1] First break possibility

[2] This is no BP since the glue is not following a box.

[3] Second break possibility

PageLayout/KnuthElementEvaluation (last edited 2009-09-20 23:52:48 by localhost)