Lambda Javaで使えるフォント一覧

一覧取得コード

  GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  Font fonts[] = ge.getAllFonts();
  for (int i = 0; i < fonts.length; i++) {
    System.out.println(fonts[i].getName());
  }


結果

Bitstream Charter
Bitstream Charter Bold
Bitstream Charter Bold Italic
Bitstream Charter Italic
Century Schoolbook L Bold
Century Schoolbook L Bold Italic
Century Schoolbook L Italic
Century Schoolbook L Roman
Courier 10 Pitch
Courier 10 Pitch Bold
Courier 10 Pitch Bold Italic
Courier 10 Pitch Italic
Cursor
DejaVu Sans
DejaVu Sans Bold
DejaVu Sans Bold Oblique
DejaVu Sans Condensed
DejaVu Sans Condensed Bold
DejaVu Sans Condensed Bold Oblique
DejaVu Sans Condensed Oblique
DejaVu Sans ExtraLight
DejaVu Sans Oblique
DejaVu Serif
DejaVu Serif Bold
DejaVu Serif Bold Italic
DejaVu Serif Condensed
DejaVu Serif Condensed Bold
DejaVu Serif Condensed Bold Italic
DejaVu Serif Condensed Italic
DejaVu Serif Italic
Dialog.bold
Dialog.bolditalic
Dialog.italic
Dialog.plain
DialogInput.bold
DialogInput.bolditalic
DialogInput.italic
DialogInput.plain
Dingbats 
Hershey Gothic- English
Hershey Gothic- German
Hershey Gothic- Italian
Hershey Plain- Duplex
Hershey Plain- Duplex- Italic
Hershey Plain- Triplex
Hershey Plain- Triplex- Italic
Hershey Script- Complex
Hershey Script- Simplex
Monospaced.bold
Monospaced.bolditalic
Monospaced.italic
Monospaced.plain
Nimbus Mono L Bold
Nimbus Mono L Bold Oblique
Nimbus Mono L Regular
Nimbus Mono L Regular Oblique
Nimbus Roman No9 L Medium
Nimbus Roman No9 L Medium Italic
Nimbus Roman No9 L Regular
Nimbus Roman No9 L Regular Italic
Nimbus Sans L Bold
Nimbus Sans L Bold Condensed
Nimbus Sans L Bold Condensed Italic
Nimbus Sans L Bold Italic
Nimbus Sans L Regular
Nimbus Sans L Regular Condensed
Nimbus Sans L Regular Condensed Italic
Nimbus Sans L Regular Italic
SansSerif.bold
SansSerif.bolditalic
SansSerif.italic
SansSerif.plain
Serif.bold
Serif.bolditalic
Serif.italic
Serif.plain
Standard Symbols L
URW Bookman L Demi Bold
URW Bookman L Demi Bold Italic
URW Bookman L Light
URW Bookman L Light Italic
URW Chancery L Medium Italic
URW Gothic L Book
URW Gothic L Book Oblique
URW Gothic L Demi
URW Gothic L Demi Oblique
URW Palladio L Bold
URW Palladio L Bold Italic
URW Palladio L Italic
URW Palladio L Roman
Utopia Bold
Utopia Bold Italic
Utopia Italic
Utopia Regular


日本語フォントがないので、IPAFontをロードしてみます。フォントファイルはjarに内包しておきます。

  Font font = Font.createFont(Font.TRUETYPE_FONT, GraphicsTest.class.getResourceAsStream("/ipagp.ttf"));
  GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  ge.registerFont(font);
  Font fonts[] = ge.getAllFonts();
  for (int i = 0; i < fonts.length; i++) {
    System.out.println(fonts[i].getName());
 }


結果

Bitstream Charter
Bitstream Charter Bold
Bitstream Charter Bold Italic
//省略
Utopia Italic
Utopia Regular
IPAPGothic


追加されました。GraphicsEnvironmentもちゃんと動いているので、描画も出来そうです。