wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Why does Font.getFont return null when looking for system font? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Why does Font.getFont return null when looking for system font?" Watch "Why does Font.getFont return null when looking for system font?" New topic
Author

Why does Font.getFont return null when looking for system font?

Dan Bizman
Ranch Hand

Joined: Feb 25, 2003
Posts: 387
I have the following code that looks for a font that I know is installed (see below). What am i doing wrong?



UPDATE: looking further into the JRE's source code, I see the getFont method is this:




I don't get it, how does that ever work? I've never seen the fonts in the system properties on any computer in any version of java. Testing on these setups, they all return null and none of them have any fonts in the system properties:

OpenSuse - Java 6
OpenSuse - Java 5
Windows XP - Java 6
Windows XP - Java 5

Does anyone on here have this method work?
Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367


SCJP1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why does Font.getFont return null when looking for system font?
 
Similar Threads
Image as part of HTML email
Can't get Graphics.setFont() to work
JEditorPane problem displaying non-English text in 1.4 (Linux)
Changing Font Size on a Chart
Having trouble with java.awt.Font.getFont(String nm, Font font)