hi,

here is a n example of how I generate English/Chinese/Pinyin in a docbook text: works perfectly

****************
<tbody>
  <row>
    <entry>
<foreignphrase xml:lang="cmn-Latn-pinyin">Wǒ kǎolǜ kǎolǜ.</foreignphrase>
        </entry>
                                            </row>
                                            <row>
<entry><foreignphrase xml:lang="cmn-Hani"

>我虑的虑的。</foreignphrase></entry>
                                            </row>
                                            <row>
<entry>I'll think it over. (non-committal)</entry>
                                            </row>
                                            <row>
<entry><foreignphrase xml:lang="cmn-Latn-pinyin" >Fēicháng hǎo.</foreignphrase></entry>
                                            </row>
***************

I use a customization part in :  xls/fo/docbook_custom.xsl

It can be another name or location (I use oXygen editor), but the principle is here

***************

    <xsl:template match="d:foreignphrase[@xml:lang='cmn-Hani']">
        <!--<fo:inline font-family="UKIJ CJK"> -->
        <fo:inline font-family="NotoSansCJKjp-Light">
<!--<fo:inline font-family="AR PL KaitiM GB"> jolie fonte mais moins lisible--> <!--<xsl:attribute name="background-color">#FFFFFF</xsl:attribute> -->
            <xsl:attribute name="color">#FF0000</xsl:attribute>
            <xsl:attribute name="font-size">1.3em</xsl:attribute>
            <xsl:call-template name="inline.charseq"/>
        </fo:inline>
    </xsl:template>

    <xsl:template match="d:foreignphrase[@xml:lang='cmn-Latn-pinyin']">
        <fo:inline>
            <xsl:attribute name="color">#0000FF</xsl:attribute>
<!--<xsl:attribute name="background-color">#FFFF00</xsl:attribute>-->
            <xsl:call-template name="inline.charseq"/>

        </fo:inline>
    </xsl:template>

***************

link to the document I'm editing at the moment (not finished, there are 1400 pages min) :

https://git.yojik.eu/eric/FSI-Chinese-docbook/src/master/out/pdf/FSI-Chinese.pdf

Best regards

Eric


Le 22/12/2021 à 04:01, M. Downing Roberts a écrit :
I'm back with another question.

I'd like to combine English and Japanese text in a single book. I can set the @lang attribute on various elements, but the problem is that I need to switch fonts, too. The font that I want to use for body text doesn't include Japanese characters. I'm not sure how to embed Japanese text within a <para> of English and get it to render properly. E.g.:

    <para>The Hōjōki [方丈記] is an important and popular short work of
    the early Kamakura period.</para>


It seems like I need something akin to <span lang="ja"> to mark the Japanese text, and then a customization in the stylesheet to detect this and specify a suitable font. However, I'm not sure how I should handle either of these issues.

I would also like to specify a different font for the <subtitle> element. I've tried this customization:

    <xsl:template match="subtitle" mode="section.titlepage.recto.auto.mode">
    <fo:block xsl:use-attribute-sets="section.titlepage.recto.style"
    font-family="Hiragino Mincho ProN">
    <xsl:apply-templates select="." mode="section.titlepage.recto.mode"/>
    </fo:block>
    </xsl:template>

    <xsl:template match="subtitle" mode="titlepage.mode">
       <fo:block font-family="Hiragino Mincho ProN">
         <xsl:apply-templates mode="titlepage.mode"/>
       </fo:block>
    </xsl:template>


...but it seems to have no effect. The font is not found, though it is installed on my machine.

What am I doing wrong? What's the best way to approach this?

Thanks!

M.

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org

Reply via email to