<?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/charbychar.xml">
        <dc:creator>Alexander Peshkov</dc:creator>
        <dc:title>Character-by-character font selection strategy</dc:title>
        <dc:description>
          <db:para>
            Explains use of <db:sgmltag class='attribute'>font-selection-strategy</db:sgmltag> 
            attribute with <db:parameter>character-by-character</db:parameter> value
            for texts in mixed languages or different charsets.
          </db:para>
        </dc:description>
        <dc:date>2003-07-08</dc:date>
        <dcterms:requires rdf:resource="http://xep.xattic.com/testsuite/usecases/generic.xsl"/>
    </rdf:Description>
  </rdf:RDF> 
  <title>Using <code>character-by-character</code> value of <code>font-selection-strategy</code> attribute</title>
  <para>
    Often you need to compose text blocks whith several language mixed together or with use of special characters.
    It these cases there might be necesary to render such a block using multiple different fonts since
    neither of them have all required glyphs. XSL FO provides special property <code>font-selection-strategy</code>
    that targets this problem togher with <code>font-family</code> property.
	<citation>
      <ulink url="http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#font-family">XSL FO Recommendation, Chapter 7.8.2 "font-family"</ulink>
    </citation>    
	<citation>
      <ulink url="http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#font-selection-strategy">XSL FO Recommendation, Chapter 7.8.3 "font-selection-strategy"</ulink>
    </citation>
    The <code>font-family</code> property allows you to specify several font families (separated by comma)
    and <code>font-selection-strategy</code> defines how these fonts will by applied by rendering engine.
    When <code>font-selection-strategy</code> is set to <code>character-by-character</code>,
    formatter will trigger font selection process for every character rendered.
  </para>
  <para>
    Consider following example:
    <codeblock>
      &lt;fo:block font-size="24pt"
                font-family="Courier, ArialMT"
                font-selection-strategy="character-by-character"&gt;
        &amp;#1072;&amp;#1073;ABC&amp;#1074;
      &lt;/fo:block&gt;
    </codeblock>
    First, second and sixth characters are Russian, the rest are basic Latin characters.
    Font Courier has glyps only for Latin characters, while ArialMT covers both Latin and Russian.
    In this example formatter will look through all fonts in order to find one that has appropriate glyph.
    This process will be repeated for every character no metter which font was selected on previous step.
    Thus characters 3, 4 and 5 will be rendered using Courier and characters 1, 2 and 6 will be
    rendered using ArialMT:
  </para>
  <simpara font-selection-strategy="character-by-character" font-family="Courier, ArialMT" font-size="24pt">
    &#1072;&#1073;ABC&#1074;
  </simpara>
  <para>
    If we replace <code>font-selection-strategy="character-by-character"</code> with 
    <code>font-selection-strategy="auto"</code> in the example above,
    formatter will restart font selecting process only when previously selected font has no required glyph.
    In such a case all six characters will be rendered using ArialMT font as shown below:
  </para>
  <simpara font-selection-strategy="auto" font-family="Courier, ArialMT" font-size="24pt">
    &#1072;&#1073;ABC&#1074;
  </simpara>
</document>