I tried to follow this example Font Awesome with Swing
Every thing work fine but when i tried to add some text the font not show correct, it show me something like this:
My code
....
try (InputStream is = TestFontAwsome.class.getResourceAsStream("fontawesome-webfont.ttf")) {
Font font = Font.createFont(Font.TRUETYPE_FONT, is);
font = font.deriveFont(Font.PLAIN, 24f);
JLabel label = new JLabel("\uf0c0 font not correct");
label.setFont(font);
label.setForeground(Color.red);
label.setFont(font);
JFrame frame = new JFrame("Testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new GridBagLayout());
frame.add(label);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
} catch (IOException | FontFormatException exp) {
exp.printStackTrace();
}
....
The result
I already installed the Font:
Any idea about the problem?