Font: getFamily() : Font « java.awt « Java by API






Font: getFamily()

 
import java.awt.Font;
import java.awt.GraphicsEnvironment;

public class MainClass {

  public static void main(String[] args) throws Exception {
    Font[] fonts  = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
    for (int i = 0; i < fonts.length; i++) {
      System.out.print(fonts[i].getFontName() + " : ");
      System.out.print(fonts[i].getFamily() + " : ");
      System.out.print(fonts[i].getName());
      System.out.println();
    }
  }
}
           
         
  








Related examples in the same category

1.Font.PLAIN
2.Font.BOLD | Font.ITALIC
3.Font.BOLD
4.Font.ITALIC
5.Font.TRUETYPE_FONT
6.new Font(String name, int style, int size)
7.Font: createFont(int fontFormat, InputStream fontStream)
8.Font: createGlyphVector(FontRenderContext frc, String str)
9.Font: deriveFont(int style, float size)
10.Font: getFontName()
11.Font: getLineMetrics(String str, FontRenderContext frc)
12.Font: getName()
13.Font: getStyle()
14.Font: getSize()
15.Font: getStringBounds(String str, FontRenderContext frc)