Get all available font names in your system in Java
Description
The following code shows how to get all available font names in your system.
Example
/*from w ww.j a v a 2 s.co m*/
import java.awt.Font;
import java.awt.GraphicsEnvironment;
public class Main {
public static void main(String[] a) {
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
Font[] fonts = e.getAllFonts(); // Get the fonts
for (Font f : fonts) {
System.out.println(f.getFontName());
}
}
}