我使用FOP 2.1生成pdf文件。它在大多数情况下都可以正常运行,但是有很多警告正在尝试消除。首先是摆脱丢失的字体警告:
2019-01-24 15:23:30.052 WARN 8772 --- [https-jsse-nio-8087-exec-6] org.apache.fop.apps.FOUserAgent : Font "Tahoma,normal,700" not found. Substituting with "any,normal,700".
2019-01-24 15:23:30.098 WARN 8772 --- [https-jsse-nio-8087-exec-6] org.apache.fop.apps.FOUserAgent : Font "Tahoma,normal,400" not found. Substituting with "any,normal,400".
Fop配置位于fop.xml文件中,并且这样:
<?xml version="1.0"?>
<fop>
<renderers>
<renderer mime="application/pdf">
<font kening="yes" embed-url="tahoma.ttf" sub-font="Tahoma">
<font-triplet name="Tahoma" style="normal" weight="normal"/>
</font>
<font kening="yes" embed-url="tahomabd.ttf" sub-font="Tahoma">
<font-triplet name="Tahoma" style="normal" weight="bold"/>
</font>
</renderer>
</renderers>
</fop>
Fop的配置如下:
InputStream inStr = this.getClass().getResourceAsStream("/fop.xml");
FopFactory fopFactory = FopFactory.newInstance(new java.net.URI("."), inStr);
我是否缺少某些东西,或者为什么找不到字体?