Re: [docbook-apps] How to change the font?

From
Keith Fahlgren <>
Date
2006-11-09T17:58:54+00:00
ID
Thread
Re: [docbook-apps] How to change the font?
On 11/9/06, Darya Said-Akbari <> wrote:
> is there a way I can change the font in my DocBook
> XML. Sometimes I want use Unicode characters but the
> font does not cover these characters.
>
> In such cases I want to select the right font which
> handles these Unicode characters.

Hi,

We've run into this problem quite a bit. In our case, we use
Microsoft's Arial, which offers fairly large coverage of Unicode. The
markup we use is the <phrase> tag with a @role="unicode", which is
nice and semanitcally meaningless:

 <para>Regular text here <phrase role="unicode"> $B>>K\(B $B9T90(B</phrase>  more
normal stuff</para>

I match this like so:
 <xsl:template match="phrase">
    <xsl:variable name="depth">
      <xsl:call-template name="dot.count">
        <xsl:with-param name="string">
          <xsl:number level="multiple"/>
        </xsl:with-param>
      </xsl:call-template>
    </xsl:variable>
   <xsl:choose>
    <xsl:when test="@role[contains(., 'unicode')]">
        <fo:inline font-family="Arial Unicode MS"> <!-- whatever font
you like -->
          <xsl:call-template name="inline.charseq"/>
        </fo:inline>
      </xsl:when>
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="$depth mod 2 = 1">
            <fo:inline font-style="normal">
              <xsl:apply-templates/>
            </fo:inline>
          </xsl:when>
          <xsl:otherwise>
            <xsl:call-template name="inline.italicseq"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
 </xsl:template>


HTH,
Keith