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:
Extracted example to a separate page

------------------------------------------------------------------------------
  
  = Examples =
  
+ See the ["SpaceResolution/Examples"] page.
- == 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
- }}}
- 
- == Example 7 ==
- 
- {{{
- <fo:block space-after="10pt" space-before.precedence="3">first line</fo:block>
- <fo:block space-before.optimum="10pt" space-before.maximum="15pt" 
space-before.precedence="3">
-   <fo:block space-before="6pt" space-before.precedence="2">second 
line</fo:block>
-   third line
- </fo:block>
- }}}
- 
- '''Break at the first break possibility:'''
- 
- We have two S':
- 
- S'[1]: space-after is suppressed under rule 1.
- 
- S'[2]: Both space-before are suppressed under rule 1.
- 
- '''No break between the blocks:'''
- 
- S' consists of all three space-specifiers in this example.
- 
- Rule 1 does not apply. The "6pt" space is suppressed under rule 3 (lower 
precedence). The two remaining space have the same optimum, but the second one 
extends the maximum for the resolved space specifier.
- 
- '''Element list:'''
- 
- (0pt|0pt vs. (min=10pt,opt=10pt,max=15pt)
- 
- {{{
- box w=lh for first block
- 
- penalty w=0 p=0 for the break possibility
- 
- aux glue w=10pt y=5pt z=0pt for the difference when no break occurs
- 
- box w=lh for second block
- }}}
- 
- == Example 8 ==
- 
- Bringing border and padding into play.
- 
- {{{
- <fo:block space-before="10pt" padding-before="5pt" 
border-before-style="solid" border-before-width="2pt">
-   <fo:block space-before="6pt">first line</fo:block>
-   second line
- </fo:block>
- }}}
- 
- We ignore the break possibility before the second line because it is 
irrelevant for this example. All spaces, paddings and borders are conditional. 
Since we begin a reference-area here, according to 4.3.1, the widths for border 
and padding both collapse to zero, so S' consists of both space-specifiers in 
this example. Both space-specifiers are conditional and are therefore 
suppressed under rule 1.
- 
- '''Element list:'''
- 
- {{{
- box w=lh for first line
- 
- penalty w=0 p=0 for the break possibility
- 
- box w=lh for second line
- }}}
- 
- == Example 9 ==
- 
- Bringing border and padding into play (continued).
- 
- {{{
- <fo:block space-before="10pt" padding-before="5pt" 
border-before-style="solid" border-before-width="2pt" 
border-before-width.conditionality="retain">
-   <fo:block space-before="6pt">first line</fo:block>
-   second line
- </fo:block>
- }}}
- 
- We ignore the break possibility before the second line because it is 
irrelevant for this example. All spaces and paddings are conditional. Only the 
border is non-conditional (the only change to the previous example). We begin a 
reference-area here, but the border interrupts the suppressing of elements like 
in the previous example. So only the first space-before is suppressed. After 
that the border is added and so is the padding as it is not suppressed under 
the conditionality rule anymore. The same applies to the second space-before.
- 
- '''Element list:'''
- 
- {{{
- box w=7pt (2pt border + 5pt padding)
- box w=0
- penalty p=INF
- glue w=6pt (space-before)
- 
- box w=lh for first block
- 
- penalty w=0 p=0 for the break possibility
- 
- box w=lh for second block
- }}}
  
  = Implementation =
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to