[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Multiple languages in PDF?
On 02/01/2022 02:26, M. Downing Roberts wrote:
...
> Another, simpler point I'm stuck on: I need to select a different font
> for the Japanese index,Âi.e., I need to detect @type='ja' in the <index>
> element and switch fonts.
If you are using AH Formatter, you can map the generic font family names
to specific fonts per script. [1]
> I tried this in my customization layer:
>
>Â Â Â<xsl:template match="indexentry">
>Â Â Â Â <xsl:choose>
>Â Â Â Â Â<xsl:when test="contains(' ja ', parent::type)">
"contains(' ja ', parent::type)" is true only when the string ' ja '
(including its space characters) contains the text content of the <type>
parent element of the <indexentry>. [1]Â There's several reasons why
that won't happen.
If you are generating <indexdiv> to group <indexterm>, then <indexterm>
isn't the parent element anyway.
One solution would be:
  <xsl:when test="ancestor::index/@type = 'ja'">
Another would be a separate template for Japanese <indexentry>, if you
would find that clearer:
<xsl:template match="indexentry[ancestor::index/@type = 'ja']">
 Â<fo:wrapper font-family="'Zen Old Mincho'">
  Â<xsl:apply-templates/>
 Â</fo:wrapper>
</xsl:template>
(fo:wrapper [3] is mostly a way to add inherited properties without
generating an extra area in the area tree.)
If your template is in a module that imports (directly or indirectly)
the usual template for <indexentry>, you can do: [4]
<xsl:template match="indexentry[ancestor::index/@type = 'ja']">
 Â<fo:wrapper font-family="'Zen Old Mincho'">
  Â<xsl:apply-imports/>
 Â</fo:wrapper>
</xsl:template>
Or you could set the font in your template for <index>:
<xsl:template match="index[@type = 'ja']">
 Â<fo:wrapper font-family="'Zen Old Mincho'">
  Â<xsl:apply-imports/>
 Â</fo:wrapper>
</xsl:template>
Regards,
Tony Graham.
--
Senior Architect
XML Division
Antenna House, Inc.
----
Skerries, Ireland
tgraham@antenna.co.jp
[1] https://www.antenna.co.jp/AHF/help/en/ahf-optset.html#script-font
[2] https://www.w3.org/TR/1999/REC-xpath-19991116/#function-contains
[3] https://www.w3.org/TR/xsl11/#fo_wrapper
[4] https://www.w3.org/TR/1999/REC-xslt-19991116#apply-imports
---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]