This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hi guys,
I have been using java.awt.Font for a while without problems, however recently all of a sudden they stopped working.
When I try to draw a string using
g.drawString("Test", 0,0);
It gives me the error:
Exception in thread "Game" java.lang.Error: Probable fatal error: No physical fonts found.
Also, whenever I try to import a custom font, I get a FontFormatException:
try
{
font = Font.createFont(Font.TRUETYPE_FONT, new File("assets/pixelated/pixelated.ttf"));
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("assets/pixelated/pixelated.ttf")));
}
catch(IOException | FontFormatException e)
{
e.printStackTrace();
}
The Exceptions thrown are:
java.awt.FontFormatException: Unexpected runtime exception.
Exception in thread "Game" java.lang.NullPointerException: Cannot invoke "java.awt.Font.deriveFont(float)" because "com.lootrunner.menu.Screen.font" is null
I am very confused because all of the code I have shown worked perfectly fine a few days ago. Now every single program I use which includes fonts do not work at all.
I am using Eclipse as my IDE, and I am on Windows 10. I uninstalled Java and reinstalled JDK 15.0.2. I am genuinely confused as even Google does not even help. The closest error I have found is Probable fatal error: No fonts found (notice how there isn't the word physical)
Any help would really be appreciated as I cannot work on anything now :(
Thank you so much
Subreddit
Post Details
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/javahelp/co...