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

<!-- This file makes part of an XSL Test Suite -->
<!-- vertical-align  baseline-shift            -->

<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:dc="http://purl.org/dc/elements/1.1/"
           xmlns:dcterms="http://purl.org/dc/terms/"
           xmlns:db="http://www.oasis-open.org/docbook/xml/4.2/">
     <rdf:Description rdf:about="http://xep.xattic.com/testsuite/features/baseline-shift.xml">
        <dc:title> Vertical Alignment Properties - Baseline Shift</dc:title>
        <dc:description>
          <db:para>
            Shows how to alter vertical position of inline elements: subscripts/superscripts.
          </db:para>
        </dc:description>
        <dc:date>2003-07-24</dc:date><dcterms:requires rdf:resource="http://xep.xattic.com/testsuite/features/macro.xsl"/>
    </rdf:Description>
  </rdf:RDF> 

<!-- These two macros serve to draw a vertical ruler, with 5 pt notches -->

  <define-macro name="ruler-numbers">
    <fo:wrapper line-height="10pt"
               line-stacking-strategy="font-height" 
               font="8pt Helvetica" 
               text-align="end">
      <repeat from="0" times="11" step="10">
        <fo:block> <counter/> pt</fo:block>
      </repeat>
    </fo:wrapper>
  </define-macro>

  <define-macro name="ruler-notches">
    <fo:wrapper line-height="5pt"
               line-stacking-strategy="font-height" 
               font="8pt Helvetica" 
               text-align="end">
      <repeat from="0" times="10">
        <fo:block>
          <fo:leader leader-length.optimum="6pt" 
                     leader-length.maximum="6pt" 
                     leader-length.minimum="6pt" 
                     leader-pattern="rule" 
                     rule-style="solid"
                     rule-thickness="0.5pt"/>
        </fo:block>
        <fo:block>
          <fo:leader leader-length.optimum="3pt" 
                     leader-length.maximum="3pt" 
                     leader-length.minimum="3pt" 
                     leader-pattern="rule"
                     color="gray" 
                     rule-style="solid"
                     rule-thickness="0.25pt"/>
        </fo:block>
      </repeat>
      <fo:block>
        <fo:leader leader-length.optimum="6pt" 
                   leader-length.maximum="6pt" 
                   leader-length.minimum="6pt" 
                   leader-pattern="rule" 
                   rule-style="solid"
                   rule-thickness="0.5pt"/>
      </fo:block>
    </fo:wrapper>
  </define-macro>

  <!-- Principal unit - test for a single font/baselines-shift pair -->
  <define-macro name="test-block">
    <fo:table space-before="12pt" space-after="12pt"
              keep-together.within-page="always">
      <fo:table-column column-width="40pt"/>
      <fo:table-column column-width="9pt"/>
      <fo:table-body>
        <fo:table-row>
          <fo:table-cell padding-right="1pt"><macro name="ruler-numbers"/></fo:table-cell>
          <fo:table-cell><macro name="ruler-notches"/></fo:table-cell>
          <fo:table-cell padding="3pt">
            <fo:block text-align="start" font="$arg1"
                      line-height="30pt">
              <macro name="outer-inline" arg1="$arg1"
                                         arg2="$arg2"
                                         arg3="baseline"
                                         arg4="sub"
                                         arg5="super"/>
              <macro name="outer-inline" arg1="$arg1"
                                         arg2="$arg2"
                                         arg3="33.3%"
                                         arg4="10pt"
                                         arg5="-15pt"/>
            </fo:block>
          </fo:table-cell>
        </fo:table-row>
      </fo:table-body>
    </fo:table>
  </define-macro>    


  <!-- Single test line -->

  <define-macro name="outer-inline">
    <fo:block text-align="start" font="$arg1">
      <fo:inline background-color="#F0F0F0" padding="0pt 3pt">
        <arg1/>
        <fo:inline border="0.25pt black solid"
                   padding="0pt 2pt"
                   baseline-shift="$arg2">
           <arg2/>
           <fo:inline background-color="#E0E080"
                      padding="0pt 3pt">
              unshifted
           </fo:inline>

            <macro name="inner-inline" arg1="$arg3"/>
            <macro name="inner-inline" arg1="$arg4"/>
            <macro name="inner-inline" arg1="$arg5"/>
        </fo:inline>
      </fo:inline>
    </fo:block>
  </define-macro>

  <define-macro name="inner-inline">
    <fo:inline background-color="#A0A0FF"
               padding="0pt 2pt"
               baseline-shift="$arg1">
      <arg1/>
    </fo:inline>
  </define-macro>

  <!-- Document body -->

  <title> Vertical Alignment Properties - Baseline Shift</title>
  <text>
    <p>
    This document tests vertical alignment of inline elements.
    The test consists of several lines of text; line height is 30 pt.
    Each line is structured as follows:
    </p>
    <ul>
      <li>
        <fo:inline background-color="#F0F0F0" padding="0pt 2pt">gray background</fo:inline>
        marks the unshifted line;
      </li>
      <li>
        <fo:inline border="0.25pt black solid" padding="0pt 2pt">black border</fo:inline>
        marks an inline shifted by the amount specified by the first word
        inside it. This box serves as a reference to all other elements;
      </li>
      <li>
        <fo:inline background-color="#E0E080" padding="0pt 2pt">yellow background</fo:inline>
        marks a nested inline unshifted from the reference box. The rectangle
        should contain the word "unshifted" and be aligned within the reference box;
      </li>
      <li>
        <fo:inline background-color="#A0A0FF" padding="0pt 2pt">light blue background</fo:inline>
        marks an inline shifted from the reference box by the speficied amount.
      </li>
    </ul>
    <p>
      To facilitate test interpretation, a ruler is drawn
      at the left of the text. 
    </p>
  </text>

  <macro name="test-block" arg1="8pt Courier" arg2="baseline"/>
  <macro name="test-block" arg1="12pt Times" arg2="sub"/>
  <macro name="test-block" arg1="16pt Times" arg2="super"/>
  <macro name="test-block" arg1="6pt Helvetica" arg2="25%"/>
  <macro name="test-block" arg1="6pt Helvetica" arg2="-50%"/>
  <macro name="test-block" arg1="10pt Courier" arg2="-5pt"/>
  <macro name="test-block" arg1="14pt Helvetica" arg2="15pt"/>
</plain-doc>

