I reviewed the sun.awt.FontConfiguration and sun.java2d.GraphicsEnvironment and found a lot of methods that could be usefull, especially the ones in the FontConfiguration class. There is no way to cast to the appropriate implementation type so i did some reflection code to get access to the implemented methods:
try {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
Method getFontConf = env.getClass().getMethod("getFontConfiguration");
Object fontConfig = getFontConf.invoke(env);
Method loadProperties = fontConfig.getClass().getMethod("loadProperties", InputStream.class);
loadProperties.invoke(fontConfig, fontConfig.getClass().getResourceAsStream("/fontconfig.properties"));
} catch (Exception e) {
e.printStackTrace();
}
There is no usefull documentation in the source only coding comments and just a simple loadProperties method call doesn't cover the trick at all. There must be a sequence of method calls that can be used to initizalize the fonts specified in the mapping.