|
How to gather the font families that are available for use |
|
|
This Java tip demostrates how to prepare a list of all the available font families. A family may
be described as a group of all the fonts with a similar or related typographic design.
For example, the font faces in the family Lucida Sans Typewriter might be Lucida Sans Typewriter Bold,
and Lucida Sans Typewriter Regular. For developer information J2SE 1.4 only supports True Type fonts.
// Get names of all the font families
GraphicsEnvironment environment =
GraphicsEnvironment.getLocalGraphicsEnvironment();
String fontNames[] = environment.getAvailableFontFamilyNames();
// A for loop for Iterating through all the font family names
for (int i=0; i<fontNames.length; i++) {
System.out.println(fontNames[i]);
// Aria
// Comic Sans MS
// Verdana
// ...
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.