Vincent Hennebert wrote:
Chris,
I'm afraid I don't agree with you here. You seem to mix up space
conditionality and space precedence. See § 4.3 of the spec, and
especially § 4.3.1, Space-resolution rules [1]
Conditionality only stands for spaces that begin a reference area; as
per the first rule, all of the conditional spaces that begin a reference
area are discarded.
Now for remaining spaces the precedence is to be considered. The space
with the highest precedence wins.
It seems you are right. My purpose for adding an item to the plan was
just to flag that this area needed further investigation. I am by no
means an expert in the details of the spec. It seems that it is mostly
working now but not 100%.
<snip/>
The second fo:block does not begin a reference area, so space
conditionality isn't taken into consideration. For both spaces,
precedence is not specified so the default value of 0 is used (§ 7.10.5
& 7.10.6). The third rule of § 4.3.1 states that between the two spaces
of the same precedence, the one that has the highest (optimum) value
wins; here the space-after of the first block.
Well the current implementation doesn't work like that. Both spaces are
included to give 20pt of space between the two paragraphs.
Imagine a scenario where you have many different documents generated
by different stylesheets, which all share a common styleset, i.e. an
imported XSL file containing xsl:attribute-sets. The styles defined
there are used throughout the documents. Now in some documents you
might have two adjacent paragraghs that both use styles with
space-before="10pt" and after="10pt".
In the document it is desirable only to have 10pt between the
paragraphs but how this be achieved? The paragraphs need to use the
styles they are using for other reasons. This is where discard comes
in handy. Add conditionality="discard" to the two styles and then the
space from one gets dropped.
Here we disagree: if I understand the spec correctly this is precedence
that should be used, e.g. like in the following:
<fo:block space-after="10mm" space-after.precedence="100">There
should be 10mm of space after this block</fo:block>
<fo:block space-before="10mm" space-before.precedence="200">There
should be 10mm of space before this block</fo:block>
I'm not an expert in the details of the spec, but isnt the precendence
ignored unless conditionality="discard"?
Here the space-before of the second block has a higher precedence than
the space-after of the first one, and thus wins. The resolved space is
10mm.
The current code gives a 20mm space between the two, which is correct
for retain but wrong for discard.
>> As per the testcase spaces-block2, I similarly think there should be a
>> space between the first and second block on page 2; anyway, in this
>> case the actual behaviour is probably wrong as the space resolution
>> rules (if I understand them correctly) seems to imply that it should
>> be only 10 points.
>
>
> Yes, that's right there should be less space - not no space.
I think Lucas is right here. The resolved space should be 10pt, that is
the optimum space of the two spaces of same value and same precedence.
If .minimum and .maximum were specified, the resolved space would take
the minimum of the two .minimum values and the max of the two .maximum
values for its own .min and .max values.
Do you agree?
Yes I do agree, with the details you describe. But I wasn't trying to
drill into detail, I was just saying it's not quite right yet. So my
point still stands: there is some work still required to get this
working 100%.
Chris