Java Reference
In-Depth Information
public class FontInfo {
public static void main(String[] args) {
Toolkit theKit = Toolkit.getDefaultToolkit();
System.out.println("\nScreen Resolution: "
+ theKit.getScreenResolution() + " dots per
inch");
Dimension screenDim = theKit.getScreenSize();
System.out.println("Screen Size: "
+ screenDim.width + " by "
+ screenDim.height + " pixels");
GraphicsEnvironment e =
GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] fontnames = e.getAvailableFontFamilyNames();
System.out.println("\nFonts available on this platform: ");
int count = 0;
for (String fontname : fontnames) {
System.out.printf("%-30s", fontname);
if(++count % 3 == 0) {
System.out.println();
}
}
}
}
FontInfo.java
On my system I get the following output:
Screen Resolution: 96 dots per inch
Screen Size: 1920 by 1080 pixels
Fonts available on this platform:
Aharoni Andalus Angsana
New
AngsanaUPC Aparajita Arabic
Typesetting
Arial Arial Black Arial
Narrow
Arial Unicode MS Batang
BatangChe
Berling Antiqua Blackadder ITC Book
Antiqua
Bookdings Bookman Old Style Bookshelf
Symbol 7
Bradley Hand ITC BRAZIL Browallia
New
BrowalliaUPC Calibri
Cambria
Cambria Math Candara
Search WWH ::




Custom Search