Luca, I need your advice again.
I changed Text LM so it knows if it has to cater for extra 'borderandpadding' at the beginning and end of lines. I then added the sequence of glue, penalty and boxes you suggested to the "normal space with default justification" case - and hooray it works fine. But I am stuck with adding knuth elements to the normal space break in the other justification cases in particular: justify, center. I just don't seem to be able to get it right. I am also unsure what the correct knuth element sequences are in the case of the forced line break and for hyphenation. Thanks Manuel On Tue, 6 Sep 2005 06:48 pm, Luca Furini wrote: > Manuel Mall wrote: > > 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. > > Sorry, you are completely right, I did not understand you were > referring to the "extra" borders needed around a line break. > > What we need is one or more elements whose overall behaviour is this: > - they represent a space (or another legal break point) > - if they are not used as a break, they behave like a normal space > (or like a not-used hyphenation point) > - if they are chosen as a break, they must add something both at the > end of the line they end, and at the beginning of the next line > > This is quite similar to the behaviour of the sequence of elements > representing a space in a centered text (in the > TextLM.getNextKnuthElements() method); so, in this case we could use: > > 1 glue width = border/padding at the end of the line = A > 2 penalty width = 0, value = 0 > 3 glue width = space.opt - (A + B), > stretch = space.max - space.opt > shrink = space.opt - space.min > 4 box width = 0 > 5 penalty width = 0, value = infinity > 6 glue with = border/padding at the beginning of the line = B > > so: > - element 1 is a legal break point, but it is never chosen as 2 is > better - element 2 is a legal break point: if it is chosen, the > ending line will reserve a width of A for border and padding, and the > next line will reserve a width of B (the glue 3 is discarded) > - element 3 is NOT a legal break because of the preceding penalty > - element 5 is NOT a legal break because of its value > - element 6 is NOT a legal break because of the preceding penalty > - is there is no break, the overall width is A + (space.opt - (A + > B)) + B = space.opt > > In order to make all this work, the TextLM should > - know that it is working on text with non-conditional borders > - "combine" this sequence with the one it would create in a "normal" > situation > > Regards > Luca