我试图用XSL样式表生成pdf 和一个带有fop.bat的XML文件(我正在使用1.1版本)。现在我需要为我的FOP添加一个自定义字体,但我似乎没有工作。我只有一个字体的TTF文件并已安装它。我试图将字体添加到Confi文件,但也许我做错了。我试图给出路径(C:\ Windows \ Fonts \ Trade Gothic bd.ttf)并使用但我仍然无法使用样式表中的font-family,它会回滚到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>
有人可以给我一个关于如何添加字体的分步介绍吗?还是纠正我的尝试?
答案 0 :(得分:0)
我找到了解决问题的方法!
我需要在conf文件中添加(fop.xconf) :
<font kerning="yes" embedurl="/Users/alisch/desktop/TradeGothicbold.ttf" embedding-mode="subset">
<font-triplet name="TradeGothic" style="normal" weight="bold"/>
</font>
<directory>/Users/alisch/desktop/TradeGothicbold.ttf</directory>
之间:
<renderer mime="application/pdf">
<fonts>
</fonts>
</renderer>
之后我需要添加
-c "C:\Users\alisch\Desktop\xml xsl test\conf\fop.xconf"
到我的命令行,它工作正常!