PDFBox IllegalArgumentException:Webdings 字体中没有字形

PDFBox IllegalArgumentException: No glyph in font Webdings

我正在尝试使用 PDFBox 写入 Webdings 字体的 PDF。我要显示的是 Webdings 中由字符 A 表示的符号。但是,我得到一个 IllegalArgumentException 说我的字体中没有给定字符的字形。我是不是遗漏了一些关于编码的东西,或者 Webdings 根本不受支持?

我使用的是PDFBox 2.0.17,很多类似问题的解决方案似乎已经过时了。我可以在 Character Map 工具中验证 Webdings,它可以在 word 等程序中使用。 我遇到的实际问题不是 Webdings,而是另一种非 public 字体,我没有任何替代品。使用 Webdings 作为问题模式似乎是相同的。

PDFont font = PDFontType0Font.load(doc, new File("pathToWebdings.ttf"));
PDPageContentStream cos = new PDPageContentStream(doc, page, AppendMode.APPEND, true);
PDStreamUtils.write(cos,"a", font, 100, 100, 100, Color.BLACK);
cos.close();

java.lang.IllegalArgumentException: 字体 Webdings

中没有 U+0061 (a) 的字形

我用 DTL OTMaster 3.7 light 查看了它(这是免费的而且非常有用),复选标记将与 \uf061 一起使用 webdings 字体(在 Windows 中测试) 10).

(因为我有4K显示器所以截图看起来有点奇怪)

或者,使用 PDType1Font.ZAPF_DINGBATS 然后 \u2714 也可以。