<?xml version="1.0" encoding="iso-8859-1"?>
<!-- ============================================================ -->
<!--                                                              -->
<!-- 	This file makes a part of RenderX XSL Test Suite          -->
<!--                                                              -->
<!--    Author: Alexander Peshkov                                 -->
<!--                                                              -->
<!--    (c) RenderX, 2003                                         -->
<!--                                                              -->
<!-- ============================================================ -->
<document>
  <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/usecases/fontembed.xml">
        <dc:creator>Alexander Peshkov</dc:creator>
        <dc:title>Fonts embedding</dc:title>
        <dc:description>
          <db:para>
            Embeds fonts of different types (Type1, TrueType, OpenType)
            and shows appopropiate configuration settings.
          </db:para>
        </dc:description>
        <dc:date>2003-07-21</dc:date>
        <dcterms:requires rdf:resource="http://xep.xattic.com/testsuite/usecases/generic.xsl"/>
    </rdf:Description>
  </rdf:RDF> 
  <title>Fonts embedding</title>
  <para>
    RenderX XEP allows you to use several types of fonts in your document:
    Adobe standard Latin fonts, PostScript Type 1 fonts,
    OpenType fonts (CID-based OpenType fonts are supported for PDF output only; subsetting is not implemented yet),
    TrueType fonts (PDF output only).
    In general, to configure a font you must add the appropriate record in XEP configuration file (xep.xml):
    <codeblock>
    &lt;font-group
          xml:base="file:/path_to_font/" 
          label="MyFont Group"&gt;
      &lt;font-family name="MyFont" embed="true" subset="true"&gt;
        &lt;font&gt;
          &lt;font-data ttf="MyFont-Regular"/&gt;
        &lt;/font&gt;
        &lt;font style="oblique"&gt;
          &lt;font-data ttf="MyFont-Italic"/&gt;
        &lt;/font&gt;
        &lt;font weight="bold"&gt;
          &lt;font-data ttf="MyFont-Bold"/&gt;
        &lt;/font&gt;
        &lt;font weight="bold" style="oblique"&gt;
          &lt;font-data ttf="MyFont-BoldItalic"/&gt;
        &lt;/font&gt;
      &lt;/font-family&gt;
    &lt;/font-group&gt;
    </codeblock>
    Detailed information about fonts usage can be found in XEP documentation included in the distribution.
    <citation>
      XEP 4.0 Reference for Java, section 2.4 "Fonts Configuration" (reference.pdf)
    </citation>
  </para>
  <subtitle>Embedded Type 1 font</subtitle>
  <para>
    As an example we will embed Cyrillic handwriting font
    (PT Pushkin) with an old orthography.
    To use this font we place it in the fonts directory specified by xml:base attribute
    (on the parent font-group element) and add the following code into xep.xml:
    <codeblock>
    &lt;font-family name="Pushkin" embed="true"&gt;
      &lt;font style="italic"&gt;
        &lt;font-data afm="Pushkin.afm"
                   pfa="Pushkin.pfa"
                   glyph-list="Pushkin.glyphs"/&gt;
      &lt;/font&gt;
    &lt;/font-family&gt;
    </codeblock>
    As specified by <code>embed</code> property this font will be embedded in the resulting document.
    Take note of the presence of <code>glyph-list</code> attribute, which provides glyph list registration.
    This is necessary since this font has non-standard glyph names.
    The following paragraph has <code>font-family="Pushkin"</code> attribute and will be rendered using this font.
  </para>
  <para font-family="Pushkin">
    &#1072;&#1073;&#1074;&#1075;
    &#1072;&#1073;&#1074;&#1075;
  </para>
  <subtitle>External Type1 font</subtitle>
  <para>
    An examplary configuration of a non-embedded Type 1 font:
    <codeblock>
    &lt;font-family name="Zapf Chancery" embed="false"&gt;
      &lt;font style="italic"&gt;
        &lt;font-data afm="uzcmi8a.afm" pfa="uzcmi8a.pfa"/&gt;
      &lt;/font&gt;
    &lt;/font-family&gt;
    </codeblock>
    Since this font is not embedded it must be available on the target system
    in order to make the output look like expected.
    The paragraph below has <code>font-family="ZapfChancery"</code>
    attribute and will be rendered using this font.
  </para>
  <para font-family="ZapfChancery">
    Rosa fresca aulentissima        ch&#x2019;apari inver&#x2019; la state
    le donne ti disïano,        pulzell&#x2019; e maritate:
    tràgemi d&#x2019;este focora,        se t&#x2019;este a bolontate;
    per te non ajo abento notte e dia,
    penzando pur di voi, madonna mia.
  </para>
  <subtitle>Embedded TrueType font</subtitle>
  <para>
    TrueType fonts in XEP can be used with PDF generator only; these fonts must be Unicode-enabled.
    An examplary configuration of an embedded ArialMT TrueType font looks as follows:
    <codeblock>
    &lt;font-family name="Arial" embed="true" subset="true"&gt;
      &lt;font&gt;
        &lt;font-data ttf="arial.ttf"/&gt;
      &lt;/font&gt;
      &lt;font style="oblique"&gt;
        &lt;font-data ttf="ariali.ttf"/&gt;
      &lt;/font&gt;
      &lt;font weight="bold"&gt;
        &lt;font-data ttf="arialbd.ttf"/&gt;
      &lt;/font&gt;
      &lt;font weight="bold" style="oblique"&gt;
        &lt;font-data ttf="arialbi.ttf"/&gt;
      &lt;/font&gt;
    &lt;/font-family&gt;
    &lt;font-alias name="ArialMT" value="Arial"/&gt;
    </codeblock>
    Each font attribute (<code>font-weight</code>/<code>font-style</code>) requires a separate <code>font</code> record in xep.xml.
    The <code>subset</code> attribute controls font subsetting.
    An embedded TrueType font can be subsetted: instead of storing the entire font in the document,
    it is possible to leave only those glyphs that are actually used in the text.
    This option reduces the output document size but makes it unsuitable for subsequent editing.
    The following paragraph has <code>font-family="ArialMT"</code> attribute and will be rendered using this font.
  </para>
  <para font-family="ArialMT">
    This is the title "Tevie the Milkman" in Yiddish:
    &#x05D8;&#x05E2;&#x05F0;&#x05D9;&#x05E2; &#x05D3;&#x05E2;&#x05E8; &#x05DE;&#x05D9;&#x05DC;&#x05DB;&#x05D9;&#x05E7;&#x05E2;&#x05E8;
  </para>
  
  <subtitle>OpenType font</subtitle>
  <para>
    You can use OpenType fonts (for example, Adobe fonts from Acrobat CJK packs).
    Those fonts are supported in PDF output only. As an example we will configure
    OpenType fonts included in the Adobe Asian Font Packs for Acrobat versions 4, 5, and 6:
    <codeblock>
    &lt;font-group 
          xml:base="path_to_Adobe_fonts/"
          label="Adobe OpenType"
          embed="true"
          subset="false"&gt;
      &lt;font-family name="Kozuka Mincho Pro Acro R"&gt;
        &lt;font&gt;
          &lt;font-data ttf="KozMinPro-Regular-Acro.otf"/&gt;
        &lt;/font&gt;
      &lt;/font-family&gt;
      &lt;font-alias name="KozMinPro" value="KozukaMinchoProAcroR"/&gt;
    &lt;/font-group&gt;
    </codeblock>
    Note that fonts themselves are not included in the distribution, and shall be made visible to the formatter in order to use them.
    The following paragraph has <code>font-family="KozMinPro"</code> attribute and will be rendered using this font.
  </para>
  <para font-family="KozMinPro">
    &#26085;&#26412;&#26085;&#26412;
    &#26085;&#26412;&#26085;&#26412;
  </para>
</document>