Using Oracle (Sun) JDK6 and trying to migrate to Oracle JDK7
I use sun.awt.GraphicsEnvironment to find all the system fonts to use to change the pdf font used in my pdf file. Here is the exact code I'm using:
GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment(); // get all system fonts final Font[] fonts = gEnv.getAllFonts();
After that, I will need to get the exact path of the font file on the system, so I use:
FontManager.getFontPath(true) + "/" + FontManager.getFileNameForFontName(font_name);
Now the problem is that sun.font.FontManager no longer a class and converted to an interface. I searched the Internet and came up with some solutions that do not suit me, and I am looking for other ideas that will help solve my problem.
The solutions I found are:
- Deploy my project in Java 6 instead of Java 7 (it is not recommended to use some new features in Java 7).
- I found the FontManager class code online, but many other classes / interfaces will be required to use it, and this process seems fictitious and time-consuming. In addition, I do not, if I am allowed to use this code, as it is the property of Sun.
What I need: * A way to find the exact path of the font file in the system *. Any ideas are welcome.
source share