java获取本机所有可用字体

<span style="font-size:18px;">//just for fun,那个28个字母的函数满满都是恶心

import java.awt.GraphicsEnvironment ;
class Tester
{
   public static void main(String args[])
   {
      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      String forName[] = ge.getAvailableFontFamilyNames();           //好长的api、、、、
      for(int i=0;i<forName.length;i++)
      {
         System.out.println(forName[i]);
      }
   }
}</span>



//我的电脑运行结果,所有可用字体

Aharoni
Andalus
Angsana New
AngsanaUPC
Aparajita
Arabic Typesetting
Arial
Arial Black
Batang
BatangChe
Browallia New
BrowalliaUPC
Calibri
Calibri Light
Cambria
Cambria Math
Candara
Comic Sans MS
Consolas
Constantia
Corbel
Cordia New
CordiaUPC
Courier New
DaunPenh
David
DFKai-SB
Dialog
DialogInput
DilleniaUPC
DokChampa
Dotum
DotumChe
Ebrima
Estrangelo Edessa
EucrosiaUPC
Euphemia
Franklin Gothic Medium
FrankRuehl
FreesiaUPC
Gabriola
Gautami
Georgia
Gisha
Gulim
GulimChe
Gungsuh
GungsuhChe
Impact
IrisUPC
Iskoola Pota
JasmineUPC
Kalinga
Kartika
Khmer UI
KodchiangUPC
Kokila
Lao UI
Latha
Leelawadee
Levenim MT
LilyUPC
Lucida Bright
Lucida Console
Lucida Sans
Lucida Sans Typewriter
Lucida Sans Unicode
Malgun Gothic
Mangal
Marlett
Meiryo
Meiryo UI
Microsoft Himalaya
Microsoft JhengHei
Microsoft New Tai Lue
Microsoft PhagsPa
Microsoft Sans Serif
Microsoft Tai Le
Microsoft Uighur
Microsoft Yi Baiti
MingLiU
MingLiU-ExtB
MingLiU_HKSCS
MingLiU_HKSCS-ExtB
Miriam
Miriam Fixed
Mongolian Baiti
Monospaced
MoolBoran
MS Gothic
MS Mincho
MS PGothic
MS PMincho
MS UI Gothic
MT Extra
MV Boli
Narkisim
Nyala
Palatino Linotype
Plantagenet Cherokee
PMingLiU
PMingLiU-ExtB
Raavi
Rod
Sakkal Majalla
SansSerif
Segoe Print
Segoe Script
Segoe UI
Segoe UI Light
Segoe UI Semibold
Segoe UI Symbol
Serif
Shonar Bangla
Shruti
Simplified Arabic
Simplified Arabic Fixed
SimSun-ExtB
Sylfaen
Symbol
Tahoma
Times New Roman
Traditional Arabic
Trebuchet MS
Tunga
Utsaah
Vani
Verdana
Vijaya
Vrinda
Webdings
Wingdings
仿宋
宋体
微软雅黑
新宋体
方正兰亭超细黑简体
楷体
黑体

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。