<?xml version='1.0' encoding='ISO-8859-1'?>

<!-- This file makes part of an XSL Test Suite -->
<!-- Graphics - Leaders &amp; Rules test       -->

<plain-doc xmlns:fo="http://www.w3.org/1999/XSL/Format">

  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
           xmlns:dcterms="http://purl.org/dc/terms/"
           xmlns:dc="http://purl.org/dc/elements/1.1/"
           xmlns:db="http://www.oasis-open.org/docbook/xml/4.2/">
     <rdf:Description rdf:about="http://xep.xattic.com/testsuite/features/leaders.xml">
        <dc:title> Rules &amp; Leaders </dc:title>
        <dc:description>
          <db:para>
            Tests several types of <db:sgmltag class="starttag">fo:leader</db:sgmltag>
            elements: space-filled, dot-filled, rule-filled, patterned.             
          </db:para>
        </dc:description>
        <dc:date>2003-07-25</dc:date><dcterms:requires rdf:resource="http://xep.xattic.com/testsuite/features/macro.xsl"/>
    </rdf:Description>
  </rdf:RDF> 

  <!-- Macro to test rule styles -->
  <define-macro name="rule-style-test">
    <fo:block>
      Style: <b><arg1/></b>, width: <b><arg2/> pt</b> 
      <fo:leader leader-length.maximum="8in" 
                 leader-length.optimum="2in"
                 leader-length.minimum="0.5in"
                 leader-pattern="rule"
                 rule-style="$arg1"
                 rule-thickness="{$arg2}pt"
                 color="gray"/>
     </fo:block>
  </define-macro>

  <!-- Macro to test leader types -->
  <define-macro name="atomic-leader">
    <fo:leader leader-pattern="$arg1"
               leader-length.optimum="{$arg2}pt" 
               leader-length.maximum="{[$arg2 * 2]}pt" 
               leader-length.minimum="{[$arg2 / 2]}pt"/>
  </define-macro>

  <!-- Macro to test content-filled leaders -->
  <define-macro name="content-leader">
    <fo:leader leader-pattern="use-content"
               leader-length.maximum="{$arg1}pt" 
               leader-length.optimum="{$arg1}pt" 
               leader-length.minimum="1em"
               leader-pattern-width="$arg2"
               color="red"><arg3/></fo:leader>
  </define-macro>

  <title> Rules &amp; Leaders</title>

  <h2>Rules</h2>

  <h3>Rule length</h3>

  <text space-before="6pt">
    If leader rules are properly implemented in your system, you will 
    see two parabolic curves:
  </text>

  <repeat from="40" to="0" step="-1">
   <fo:block text-align="start" line-height="1mm">
    <fo:leader leader-length="{[1 + $counter * $counter / 400]}in" 
               leader-pattern="rule"
               rule-style="solid"
               line-height="1mm"
               rule-thickness="1mm" 
               color="#E00000"/>
   </fo:block>
  </repeat>
   
   <fo:block text-align="center" line-height="3mm">
    <fo:leader leader-length="3mm" 
               leader-pattern="rule"
               rule-style="solid"
               rule-thickness="3mm" 
               color="black"/>
   </fo:block>

  <repeat from="0" to="40" step="1">
   <fo:block text-align="end" line-height="1mm">
    <fo:leader leader-length="{[1 + $counter * $counter / 400]}in" 
               leader-pattern="rule"
               rule-style="solid"
               rule-thickness="1mm" 
               color="#0000E0"/>
   </fo:block>
  </repeat>
    
  <text space-before="6pt">
    The upper curve is red, and the lower one is blue. Both curves are
    composed of bars 1 mm thick, whose length is varied to form
    a parabolic profile. There are 41 bars in every set, and their length
    varies from 1.00 inch to 5.00 inch, following a quadratic law.
    Red bars are aligned to the left, and blue ones to the right.
    There is also a black square 3 x 3 mm,
    placed in the center of the whole image.
  </text>

  <h3>Rule style</h3>

  <text>
    The following blocks illustrate various styles and widths of rules 
    produced by an <code>fo:leader</code>: 
  </text>

  <macro name="rule-style-test" arg1="solid" arg2="1"/>
  <macro name="rule-style-test" arg1="dashed" arg2="2"/>
  <macro name="rule-style-test" arg1="dotted" arg2="3"/>
  <macro name="rule-style-test" arg1="double" arg2="4"/>
  <macro name="rule-style-test" arg1="ridge" arg2="5"/>
  <macro name="rule-style-test" arg1="groove" arg2="6"/>
  <macro name="rule-style-test" arg1="none" arg2="7"/>

  <h2>Dot-filled leaders</h2>
  <text>
    In the following paragraph, text will be interspersed with inlined dot-filled
    leaders. For every inserted leader, its <code>length.optimum</code>
    is equal to the number immediately preceding it; <code>.minimum</code>
    is one half, and <code>.maximum</code> is twice the value
    of <code>.optimum</code>.
  </text>

  <fo:block space-before="6pt" space-after="6pt">
    <repeat from="12" to="72" step="12">
      <fo:inline keep-together.within-line="always"><counter/> points</fo:inline>
      <macro name="atomic-leader" arg1="dots" arg2="$counter"/>
    </repeat>
  </fo:block>
  
  <h2>Spacing leaders</h2>
  <text>
    In the following paragraph, text will be interspersed with inlined space
    leaders. Leader lengths are the same as in the preceding test.
  </text>

  <fo:block space-before="6pt" space-after="6pt">
    <repeat from="12" to="72" step="12">
      <fo:inline keep-together.within-line="always"><counter/> points</fo:inline>
      <macro name="atomic-leader" arg1="space" arg2="$counter"/>
    </repeat>
  </fo:block>

  <text>
    The following paragraph contains pattern-filled leaders with an empty pattern.
    By the spec, they should be treated the same as space-filled, so the two blocks
    above and below this text should appear identical:
  </text>

  <fo:block space-before="6pt" space-after="6pt">
    <repeat from="12" to="72" step="12">
      <fo:inline keep-together.within-line="always"><counter/> points</fo:inline>
      <macro name="atomic-leader" arg1="use-content" arg2="$counter"/>
    </repeat>
  </fo:block>

  <h2>Pattern-filled leaders</h2>
  <text>
    Given below are several examples of leaders filled with text patterns.
    Text inside the leader is typed in red characters.
  </text>
  <p space-before="6pt">
    Leader filled with underscores, 72 pt long:
    <macro name="content-leader" arg1="72" arg2="use-font-metrics" arg3="_"/>
  </p>
  <p space-before="6pt">
    Leader filled with tildes, 72 pt long, pattern width is fixed to 12 pt:
    <macro name="content-leader" arg1="72" arg2="12pt" arg3="~"/>
  </p>

  <p space-before="6pt">
    Leader filled with a character sequence <code>ABCD</code>, long enough
    to expand to the end-of-line:
    <macro name="content-leader" arg1="720" arg2="use-font-metrics" arg3="ABCD"/>
  </p>

  <p space-before="6pt">
    Same as above but with pattern width fixed to 1 in:
    <macro name="content-leader" arg1="720" arg2="1in" arg3="ABCD"/>
  </p>

</plain-doc>
