Followup question from this one: Swing font names do not match? (Making a font chooser, and am trying to display the default system font in a JComboBox)
It appears there are logical and physical fonts. The logical fonts are: Serif, SansSerif, Monospaced, Dialog, and DialogInput.
These fonts are dynamic, and their respective physical font (the font that they will represent during program execution) are decided when the program loads.
I need to access the physical font of these logical fonts.
My first idea was to try and load these files: http://download.oracle.com/javase/6/docs/technotes/guides/intl/fontconfig.html#loading
by using something like this: http://www.rgagnon.com/javadetails/java-0434.html
public static Properties load(String propsName) throws Exception {
Properties props = new Properties();
URL url = ClassLoader.getSystemResource(propsName);
props.load(url.openStream());
return props;
}
and then getting the physical fonts from these properties files.
However, I am just getting NullPointerExceptions when trying to load the properties using the names in the first file (they are not found, but I have checked and actually found them on my system). I don't know why I am getting this, but regardless of that, I can't help to think there must be an easier way to do this?