package org.kodejava.awt;
import java.awt.Font;
import java.awt.GraphicsEnvironment;
public class FontNameList {
public static void main(String[] args) {
// Get all available fonts from GraphicsEnvironment
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
Font[] fonts = ge.getAllFonts();
// Iterates all available fonts and get their name and family name
for (Font font : fonts) {
String fontName = font.getName();
String familyName = font.getFamily();
System.out.println("Font: " + fontName + "; family: " + familyName);
}
}
}
Here are some fonts name printed from the code snippet above:
Font: Agency FB; family: Agency FB
Font: Agency FB Bold; family: Agency FB
Font: Algerian; family: Algerian
Font: Arial; family: Arial
Font: Arial Black; family: Arial Black
Font: Arial Bold; family: Arial
Font: Arial Bold Italic; family: Arial
Font: Arial Italic; family: Arial
Font: Arial Narrow; family: Arial Narrow
Font: Arial Narrow Bold; family: Arial Narrow
...
Latest posts by Wayan (see all)
- How do I create a table with multiple header in iText 8? - March 16, 2024
- How do I add Image to a Table in iText 8? - March 11, 2024
- How do I downgrade Android SDK emulator version? - February 12, 2024