我试图了解以下documentation。所以这是我天真的尝试:
$ cat custom.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
<xsl:param name="symbol.font.family" select="'Symbol,ZapfDingbats,Lucida Sans Unicode'"/>
<xsl:template match="symbol[@role = 'symbolfont']">
<fo:inline font-family="Symbol">
<xsl:call-template name="inline.charseq"/>
</fo:inline>
</xsl:template>
</xsl:stylesheet>
和输入docbook 5:
$ cat bla.xml
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<article xmlns="http://docbook.org/ns/docbook" version="5.0">
<section>
<title>title</title>
<!--symbol role="symbolfont">➜</symbol--><!-- removed since not valid -->
<para>before <symbol role="symbolfont">➜</symbol></para>
<para><symbol role="symbolfont">➜</symbol> after</para>
<para>➜</para>
</section>
</article>
我使用的编译:
$ xsltproc --nonet -o bla.fo custom.xsl bla.xml
Note: namesp. cut : stripped namespace before processing title
Note: namesp. cut : processing stripped document title
Making portrait pages on USletter paper (8.5inx11in)
$ fop bla.fo bla.pdf
[WARN] FOUserAgent - Font "Symbol,normal,700" not found. Substituting with "Symbol,normal,400".
[WARN] FOUserAgent - Font "ZapfDingbats,normal,700" not found. Substituting with "ZapfDingbats,normal,400".
[WARN] FOUserAgent - Glyph "➜" (0x279c, a167) not available in font "Symbol".
[INFO] FOUserAgent - Rendered page #1.
导致以下内容:
那么为什么<para>➜</para>
在我的情况下工作而不在其他工作呢?
注意这个问题与Debian密切相关,因为Debian不发布Times字体。
答案 0 :(得分:0)
事实上,这很简单。我需要使用ZapfDingbats
代替:
<xsl:template match="symbol[@role = 'symbolfont']">
<fo:inline font-family="ZapfDingbats">
<xsl:call-template name="inline.charseq"/>
</fo:inline>
</xsl:template>