Notes on the collapsing border model

Painting the borders for the separate border model is relatively simple. For the collapsing border model this can become complicated. The following is an attempt to analyze how the borders should be painted in this model. The sequence of images should also help identify what information besides the traits defined in the XSL-FO spec are necessary to properly paint the individual borders.

1. A part of a table (grid lines)

http://people.apache.org/~jeremias/fop/border-collapse1.png

2. Resolution of the individual borders according to the rules in the FO spec

http://people.apache.org/~jeremias/fop/border-collapse2.png

3. 33. Inner and outer join points (where the individual borders meet)

http://people.apache.org/~jeremias/fop/border-collapse3.png

Each join point together with the intersecting points of the basic table grid lines (see 1) for form the edges of a polygon which is used to clip the border line. In PDF the border line can simply be painted as a line. This line is clipped by a polygon with 6 points (4 join points plus 2 grid line intersection points).

TODO Find out what strategy to use for painting the border.

4. Resulting borders

http://people.apache.org/~jeremias/fop/border-collapse4.png

5. Final result

http://people.apache.org/~jeremias/fop/border-collapse5.png

Spanned cells

A border line of a spanned cell may be adjacent to several neighbouring cells which may have different border widths. When doing border resolution this means you can't look at already spanned cells but only at cell slots. This has also a consequence for border painting depending on the painting strategy (see above). If strategy 1 is used the LM has to create separate areas for borders if a cell is spanned. The border traits cannot simply be set on the normal cell areas.

As the image above suggests the padding rectangle cannot simply be calculated using the cell's own border properties. If we'd do that the content rect might overlap with a border line producing ugly results. This means that the padding rectangle has to be calculated from the already resolved borders. The effective border width for this calculation is half the width of the widest border line in a segment.

Reference

CollapsingBorderModel (last edited 2009-09-20 23:52:31 by localhost)