Manuel Mall wrote:

Next problem: border conditionality - how do I model that with the Knuth approach? At the time I add the Border/Padding start/end boxes we don't have line breaks so they really only cover the .conditionality=discard case. How do I tell the algorithm to leave enough space at the end of each line (and the beginning of the next line) for the borders (in the case of .conditionality=retain)?

The sequence of elements representing the inline content starts and ends with a box [1].

Adding another box at the beginning and at the end of the sequence implements "retain", as a line break is never allowed to separate two adjacent boxes: so, the left border and padding will always be in same line as the first piece of content, and the breaking algorithm will always reserve enough space.

In order to implement "discard", glue elements must be used instead: these elements are discarded if they are chosen as a line break or they are adjacent to a line break, and in this case borders and padding will not be painted.

I think that a single box or glue element could be created, representing both border and padding, unless the conditionalities of these properties can be different: for example, if it were possible to have border-start.conditionality = "discard" and padding-start.conditionality = "retain" two distinct elements should necessarily be created.


[1] Or, better, everything should work well if the first and last elements are boxes. Should there be spaces at the beginning and at the end of the inline having borders, they should be handled as non-breaking spaces, in order to avoid a break between the start border and the first word, or between the last word and the end border.

Reply via email to