This page looks at issues around the generation of Knuth element for break possibilities.
Borders and Padding
Borders and paddings are generally replicated on each page when a block-level FO spans more than a page. Nesting FOs can cause multiple such marks to appear at the beginning and at the end of a page. For each break possibility inside an FO and for breaks between FOs that are nested under a parent breaking such marks, these border and padding widths may have to be taken into account when building the element list for the break possibility, depending on their order. (The first non-conditional length (counted from the edge of the reference area) will cause subsequent conditional lengths to appear in every case. This last sentence is probably wrong!)
The general pattern for only border and padding
The general pattern for a break possibility with only borders and padding inside an FO is:
penalty w="<pb-after>" p="0" aux glue w="-<pb-before>" //get's discarded if a break happens on the penalty above box w="0" //represents the first valid element after a break penalty w="0" p="INF" //make the following glue unbreakable aux glue w="<pb-before>"
- pb-after = the sum of border and padding length after all trailing conditional lengths have been omitted
- pb-before = the sum of border and padding length after all leading conditional lengths have been omitted
In case there are no borders and padding to replicate in a break condition, the pattern can be simplified to:
penalty w="0" p="0"
As can be seen here, all the participating conditional lengths have to be summed up because the penalty has to take the sum of the lengths as its width. The area tree generating stage will have to make sure it can itself determine whether the mark for the border and/or padding has to be generated or not.
Spaces between FOs will further complicate the break possibility building in that they may contribute additional elements to the list of elements that are needed to find the right element list for a break possibility. 4.3.1 Space-resolution Rules explains the interaction between all the three elements: spaces, border and padding.
For detailed information about space resolution and its implementation in the Knuth approach, please see SpaceResolution.