在 SVG 中渲染 truetype 字体时出现问题
我在通过 fop 将 svg 内的 truetype 字体渲染为 pdf 时遇到问题。
在最终的 pdf 中,字体是 Times New Roman,而不是我期望的 truetype 字体。
该文档的主要字体系列使用 Type 1 字体,并且还使用我生成的字体规格,并且这些字体规格显示正确。我认为 truetype 版本的字体过去只是为了图表而添加的。
奇怪的是,这在一个阶段起作用,但似乎已经停止工作,我现在无法让它恢复工作,因为我不明白它一开始是如何工作的。为了尝试让它恢复工作,我尝试了 Java 6、Java 5 和 FOP 0.95 和 0.93 以及最新的 FOP 主干的不同组合,但都没有成功。即使在 fop 生成中启用了完整跟踪,我也没有看到字体被 Times New Roman 替换的情况,但我认为这是因为 Batik 负责此渲染。
我已经运行了一些示例 Java 代码,并且 AWT 似乎可以正确地看到 TrueType 字体,我相信这就是 Batik 正在使用的字体。
我还尝试在 fop.xconf 文件中使用字体替换,但这似乎没有效果。在 fop.xconf 中,我只定义了 Type 1 字体和另一种 True Type 字体 Zapfdingbats,它们在 pdf 中得到了正确处理。我是否还应该在此处添加其他 truetype 字体,但检查我们的版本历史记录,它过去似乎并不存在。
我在这里缺少什么吗,因为我认为蜡染会采用 Windows ttf 字体并渲染它,但这似乎不起作用。任何帮助将不胜感激。 谢谢, 克罗克德
I'm having an issue with the rendering of a truetype font inside an svg being rendered to a pdf through fop.
In the final pdf the font comes out with Times New Roman instead of the truetype font I had expected.
The main font family of the document is using Type 1 fonts and are also using font metrics that I generated and these are appearing correctly. I think the truetype version of the font was added simply for the chart in the past.
The strange thing is that this was working at one stage and appears to have stopped working and I now cannot get it back working as I don't understand how it would have worked in the first place. To try and get it back working I have gone through different combinations of Java 6, Java 5 and FOP 0.95 and 0.93 and the latest FOP trunk all without success. Even with full trace enabled in the fop generation I see no mention of the font being substituted with Times New Roman but I assume this is because Batik takes responsibilty for this rendering.
I have run some sample Java code and the TrueType font seems to be correctly seen by AWT which I believe is what Batik is using.
I've also tried using font-substitions in the fop.xconf file but this didn't seem to have an effect. In the fop.xconf I have only defined the Type 1 fonts and one other True Type Font Zapfdingbats which are handled correctly in the pdf. Should I also add the other truetype font here but checking our version history it doesn't seem to have been there in the past.
Is there anything I'm missing here as I thought the batik would take the windows ttf font and render it but this doesn't seem to work. Any help would be greatly appreciated.
Thanks,
Crocked
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看 FOP 用户邮件列表上的以下答案:
因此,要实现此功能,您应该执行以下操作:
Take a look at the following answers made on the FOP users mailing list:
So, to make this work, you should do the following: