U+0151 ('odblacute') is not available in this font Times-Roman encoding: WinAnsiEncoding

允我心安 提交于 2019-12-11 00:55:09

问题


I'm trying to set some text ( classical Hungarian dummy: árvíztűrő tükörfúrógép ):

contentStream.showText(text);

method with PDFBOX 2.0.7,and i got

U+0151 ('odblacute') is not available in this font Times-Roman encoding: WinAnsiEncoding

for őűŐŰ characters with all PDType1Font types. Other accented characters are working. Can anyone help me? Thanx a lot!


回答1:


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"));

see also the EmbeddedFonts.java example in the source code download.



来源:https://stackoverflow.com/questions/46351353/u0151-odblacute-is-not-available-in-this-font-times-roman-encoding-winansi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!