I need to draw a special character using graphics2d but some characters are not avaiable. For example, the character ➿ is rendered like a box:
Here is my code:
private void drawIcon(Graphics2D g2d) {
g2d.setColor(iconColor);
g2d.setFont(iconFont);
FontMetrics fm = g2d.getFontMetrics();
Rectangle2D r = fm.getStringBounds(icon, g2d);
int x = (int) ((getSize().getWidth() - (int) r.getWidth()) / 2);
int y = (int) ((getSize().getHeight() - (int) r.getHeight()) / 2 + fm.getAscent());
System.out.println(x + " " + y);
System.out.println(icon);
g2d.drawString(icon, x, y);
}
Where icon is, for example, the string "\u27BF" which should be displayed as "➿".
How could I add support to this character in my code?