I have a custom font installed on my PC called “BMW1”. I’m trying to loop through all entries in this font and display them in a JTextArea.
I have the following code:
JTextArea displayArea = new JTextArea();
Font font = new Font("BMW1", Font.PLAIN, 72);
displayArea.setFont(font);
String sample = "";
for (int current = 0; current < 300; current++)
sample += new Character((char)current).toString() + "\n";
displayArea.setText(sample);
When I run my program, it just prints out those little boxes (which I assume means it couldn’t find a font entry for that iteration).
Am I doing something wrong here? Is JTextArea the best option for this sort of thing? Any suggestions on how to do this?
Used Font canDisplay() methods to determine that Java can’t display this font.
I ended up switching to C# which has better support for custom fonts (at least in this particular case).