Luca,

thanks for taking the time to respond. Comments inline.

On Tue, 6 Sep 2005 05:26 pm, Luca Furini wrote:
> 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].

Yes, that's what I have done (your [1] below) and it works fine for the 
"discard" case, that is only start/end borders at the beginning and end 
of the whole fo:inline.

>
> 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.
>

These two paragraphs confuse me - sorry. My understanding was:

discard = start/end borders/padding only at the start and end of the 
whole fo:inline

retain = as discard plus start/end borders/padding on the start and end 
of every line the fo:inline spans.

It is the retain bit that I don't know how to model because the space 
has to be reserved at the beginning and end of every line. This 
information is not available by the time I build up the Knuth 
sequences. May be this is outside the Knuth algorithm and needs to be 
done by adjusting the available IPD on a line by line basis, i.e. 
subtracting any left and right borders and padding. But then again we 
only know where a fo:inline starts and ends after the linebreaking has 
run. This seems to indicate that the line breaking algorithm needs to 
know when an fo:inline starts / ends and adjust the IPD on the fly.

Very confusing....

> 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.

Very good point - padding and border have separate conditionality. Oh 
well, I won't run out of things to do then, will I.

>
> Regards
>      Luca
>
> [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.

Another refinement :-)

Manuel

Reply via email to