如何使用Java Graphics.DrawString绘制Wingding.ttf字体的字符?
我正在尝试使用Java Graphics.DrawString从Wingding.ttf字体中绘制字符。但生成的图像只包含矩形,而不包含字符如何使用Java Graphics.DrawString绘制Wingding.ttf字体的字符?,java,graphics,drawstring,non-unicode,Java,Graphics,Drawstring,Non Unicode,我正在尝试使用Java Graphics.DrawString从Wingding.ttf字体中绘制字符。但生成的图像只包含矩形,而不包含字符 BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR); Graphics graphics = image.getGraphics(); Font font = new Font("Wingdings", Font.PLAIN, 20); gra
BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR);
Graphics graphics = image.getGraphics();
Font font = new Font("Wingdings", Font.PLAIN, 20);
graphics.setFont(font);
graphics.setColor(Color.BLACK);
graphics.drawString("\u00d8", 10, 10); // THREE-D TOP-LIGHTED RIGHTWARDS ARROWHEAD char
ImageIO.write(image, "PNG", new File(TEST_DATA_DIR + "bullet_char.png"));
我该怎么做呢?我不认为wingdings是“标准”字体之一
加载字体后(始终为平面1 pnt),您可以导出所需的样式和大小 这里已经回答了类似的问题:,您需要通过
\uF0d8
而不是\u00d8
graphics.drawString("\uF0d8", 10, 10);
graphics.drawString("\uF0d8", 10, 10);