【发布时间】:2015-10-21 09:16:22
【问题描述】:
我正在尝试使用 XSL 样式表生成 pdf
和一个带有 fop.bat 的 XML 文件(我使用的是 1.1 版本)。现在我需要在我的 FOP 中添加一个自定义字体,但我似乎不起作用。我只有一个字体的 TTF 文件并已经安装了它。我试图将字体添加到 Confi 文件中,但也许我做错了。我试图给出路径(C:\Windows\Fonts\Trade Gothic bd.ttf)并使用,但我仍然无法在样式表中使用字体系列,它会回滚到 TimesNewRoman。
<font kerning="yes" embed-url="'C:/Windows/Fonts/Trade Gothic bd.ttf'" embedding-mode="subset">
<font-triplet name="TradeGothic" style="normal" weight="normal"/>
</font>
来自命令行的消息
WARNUNG: Font "TradeGothic,normal,400" not found. Substituting with "any,normal,400".
Okt 21, 2015 11:10:10 AM org.apache.fop.events.LoggingEventListener processEvent
这些行来自我的样式表
<fo:block color="rgb(0,108,183)" font-family="TradeGothic" font-style="normal" font-weight="normal">
<xs:value-of select="headdescription"/>
</fo:block>
谁能给我一个关于如何添加字体的分步介绍?还是对我的尝试进行更正?
【问题讨论】:
-
您是否正在调用 FOP(从命令行或代码)而没有告诉它使用您的配置文件?
-
我没有特别告诉命令行这样做,因为它是刚刚编辑的普通配置文件。我尝试了以下方法: C:\Users\alisch\Desktop\xml xsl test>fop.bat -xml "C:\Users\alisch\Desktop\xml x sl test\test\xmltest.xml" -xsl "C: \Users\alisch\Desktop\xml xsl test\test\xsltes t.xsl" -pdf zpdf.pdf -c "C:\Users\alisch\Desktop\xml xsl test\conf\fop.xconf" 并命名该conf文件但还是一样。
标签: css xslt fonts apache-fop custom-font