我正在使用itextpdf创建一个PDF文件,需要度数符号。我知道它存在于Times-New-Roman字体中。使用unicode字符串适用于Swing但不适用于itext。它只显示文字字符串。
Font headerFont = new Font(FontFamily.TIMES_ROMAN, 10.f, Font.BOLD, BaseColor.BLACK);
我在变量中设置了度数符号:
tempScale="\\u00B0C";
我将字符串添加到我的PDF中:
table.addCell(createCell("Actual\nTemperature\n"+tempScale,headerFont));
我读到了添加basefont.IDENTITY_H以访问字体中的所有符号,但我不清楚如何将其合并到Times-New-Roman字体实例中。有人能告诉我如何显示学位符号吗? TIA。
答案 0 :(得分:1)
不要逃避unicode角色
String tempScale = "\u00B0C";