How to list the avaiable fonts in Java

To list the avaiable fonts in Java you can use the following snippet.

Sample Java

GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();
String fonts[] = g.getAvailableFontFamilyNames();
for (int Counter = 0; Counter < fonts.length;Counter++ ){
	System.out.println(fonts[Counter]);
}

Please Share us:
Please rate this snippet

One thought on “How to list the avaiable fonts in Java

Leave a Reply