You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by Apache Wiki <wi...@apache.org> on 2005/09/12 15:56:44 UTC
[Xmlgraphics-fop Wiki] Update of "SpaceResolution" by JeremiasMaerki
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Xmlgraphics-fop Wiki" for change notification.
The following page has been changed by JeremiasMaerki:
http://wiki.apache.org/xmlgraphics-fop/SpaceResolution
The comment on the change is:
Collected notes on space resolution
New page:
This page analyzes aspects around the space-resolution rules defined in 4.3.1 in the spec.
'''Legend:'''
* lh = line height
= General pattern for the Knuth layout system =
{{{
glue - penalty - glue - box - PENALTY - glue
}}}
with:
* glue #1 is the resolved space after block 1 if a break occurs
* glue #2 is the resolved space before block 2 if a break occurs
* penalty is a feasible break
* PENALTY forbids a break
* glue #2 is the difference between glue #1 + glue #3 and the resolved space if there is no break
= Examples =
== Example 0 ==
This is the one from the spec (in chapter 4.3.1).
{{{
<fo:block space-before="10pt">
<fo:block space-before="4pt" space-before.conditionality="retain">
<fo:block space-before="5pt">
In olden times when wishing still helped one, there lived a king whose daughters
</fo:block>
</fo:block>
</fo:block>
}}}
The 10pt space is suppressed due to rule 1. It is conditional and begins a reference area.
The rest of the spaces are non-forcing, so rule 2 is skipped.
The 4pt space is suppressed under rule 3. It has the same precedence as the 5pt space but has a smaller optimum length. Since there will only be one resolved space it will be 5pt.
== Example 1 ==
A simple (conditional) space.
{{{
<fo:block>first block</fo:block>
<fo:block space-before="10pt">second block</fo:block>
}}}
'''Element list:'''
{{{
box w=lh for first block
penalty w=0 p=0 for the break possibility
aux glue w=10pt for the space in case there is no break
box w=lh for second block
}}}
== Example 2 ==
A non-conditional space.
{{{
<fo:block>first block</fo:block>
<fo:block space-before="10pt" space-before.conditionality="retain">second block</fo:block>
}}}
'''Element list:'''
{{{
box w=lh for first block
penalty w=0 p=0 for the break possibility
box w=0 //auxiliary element for the following penalty
penalty p=INF //conditionality=retain
aux glue for space-before
box w=lh for second block
}}}
== Example 3 ==
The collapsing of the adjacent conditional spaces according to rule 3.
{{{
<fo:block space-after="10pt">first block</fo:block>
<fo:block space-before="10pt">second block</fo:block>
}}}
'''Break between the blocks:'''
We have two S' which each contains one space specifier.
S'[1]: The space-after on the first block is suppressed because it is conditional and ends a reference-area. (rule 1)
S'[2]: The space-before on the second block is suppressed because it is conditional and begins a reference-area. (rule 1)
'''No break between the blocks:'''
S' consists of both space-specifiers in this example (Case 3a under 4.2.5. Stacking Constraints).
Rule 1 does not apply. No forcing space-specifiers (rule 2). Both non-forcing space-specifiers collapse to a single space with 10pt.
'''Element list:'''
{{{
box w=lh for first block
penalty w=0 p=0 for the break possibility
aux glue w=10pt for the space in case there is no break
box w=lh for second block
}}}
== Example 4 ==
{{{
<fo:block space-after="10pt" space-after.conditionality="retain">first block</fo:block>
<fo:block space-before="10pt">second block</fo:block>
}}}
'''Break between the blocks:'''
We have two S' which each contains one space specifier.
S'[1]: No space-specifiers are suppressed.
S'[2]: The space-before on the second block is suppressed because it is conditional and begins a reference-area. (rule 1)
'''No break between the blocks:'''
S' consists of both space-specifiers in this example (Case 3a under 4.2.5. Stacking Constraints).
Rule 1 does not apply. No forcing space-specifiers (rule 2). Both non-forcing space-specifiers collapse to a single space with 10pt.
'''Element list:'''
(10pt|0pt vs. 10pt)
{{{
box w=lh for first block
box w=0
penalty p=INF //conditionality=retain
aux glue w=10pt for space-after
penalty w=0 p=0 for the break possibility
box w=lh for second block
}}}
== Example 5 ==
{{{
<fo:block space-after="10pt" space-after.conditionality="retain">first block</fo:block>
<fo:block space-before="10pt" space-before.conditionality="retain">second block</fo:block>
}}}
'''Break between the blocks:'''
We have two S' which each contains one space specifier.
S'[1]: No space-specifiers are suppressed.
S'[2]: No space-specifiers are suppressed.
'''No break between the blocks:'''
S' consists of both space-specifiers in this example (Case 3a under 4.2.5. Stacking Constraints).
Rule 1 does not apply. No forcing space-specifiers (rule 2). Both non-forcing space-specifiers collapse to a single space with 10pt.
'''Element list:'''
(10pt|10pt vs. 10pt)
{{{
box w=lh for first block
box w=0
penalty p=INF //conditionality=retain
aux glue w=10pt for space-after
penalty w=0 p=0 for the break possibility
aux glue w=-10pt for the difference when no break occurs
box w=0
penalty p=INF
aux glue w=10pt for space-before
box w=lh for second block
}}}
== Example 6 ==
{{{
<fo:block space-after="10pt" space-after.conditionality="retain">first line</fo:block>
<fo:block space-before="10pt" space-before.conditionality="retain">
<fo:block space-before="6pt" space-before.precedence="force">second line</fo:block>
third line
</fo:block>
}}}
'''Break at the first break possibility:'''
We have two S':
S'[1]: space-after is not suppressed.
S'[2]: non-conditional space-before="10pt" and a forcing space-before="6pt". The "10pt" space gets suppressed under rule 2.
'''No break between the blocks:'''
S' consists of all three space-specifiers in this example (similar to case 3b under 4.2.5. Stacking Constraints).
Rule 1 does not apply. "6pt" space is forcing, the other spaces are suppressed.
'''Element list:'''
(10pt|6pt vs. 6pt)
{{{
box w=lh for first block
box w=0
penalty p=INF //conditionality=retain
aux glue w=10pt for space-after
penalty w=0 p=0 for the break possibility
aux glue w=-10pt for the difference when no break occurs
box w=0
penalty p=INF
aux glue w=6pt for space-before
box w=lh for second block
}}}
= Implementation =
Ideas for the implementation can be found here:
http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-dev/200509.mbox/%3cPine.LNX.4.62.0509091354320.29316@malatesta.cs.unibo.it%3e
http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-dev/200509.mbox/%3c20050910195456.GC5644@oranjetip.leverkruid.nl%3e
http://mail-archives.apache.org/mod_mbox/xmlgraphics-fop-dev/200509.mbox/%3c20050911101013.GA4716@oranjetip.leverkruid.nl%3e
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org