U+0151 ('odblacute') 在此字体中不可用 Times-Roman 编码:WinAnsiEncoding [英] U+0151 ('odblacute') is not available in this font Times-Roman encoding: WinAnsiEncoding
问题描述
我正在尝试设置一些文本(经典的匈牙利假人:árvíztűrő tükörfúrógép):
I'm trying to set some text ( classical Hungarian dummy: árvíztűrő tükörfúrógép ):
contentStream.showText(text);
使用 PDFBOX 2.0.7 的方法,我得到了
method with PDFBOX 2.0.7,and i got
U+0151 ('odblacute') is not available in this font Times-Roman encoding: WinAnsiEncoding
适用于所有 PDType1Font 类型的 őűŐŰ 字符.其他重音字符正在工作.谁能帮我?非常感谢!
for őűŐŰ characters with all PDType1Font types. Other accented characters are working. Can anyone help me? Thanx a lot!
推荐答案
好吧,ő"在 WinAnsiEncoding 中不可用.正如 FAQ 中所述:要了解 WinAnsiEncoding 是什么,请查看 PDF 规范附录 D.如果字符在您选择的字体中可用(在 Windows 中,请使用 charmap.exe 查看),然后像这样加载字体:
Well yes, "ő" is not available in WinAnsiEncoding. As explained in the FAQ: to see what WinAnsiEncoding is, look at the PDF Specification Appendix D. If the character is available in your chosen font (in windows, have a look with charmap.exe), then load the font like this:
PDFont font = PDType0Font.load(document, new File("c:/windows/fonts/times.ttf"));
另见 EmbeddedFonts.java 源代码下载示例.
see also the EmbeddedFonts.java example in the source code download.
这篇关于U+0151 ('odblacute') 在此字体中不可用 Times-Roman 编码:WinAnsiEncoding的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!