Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Dan Bizman
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!