首页 > 代码库 > 如何字体优化

如何字体优化

 

package com.forget406.study;

import java.awt.GraphicsEnvironment;

public class CustomeFontReading {
public static void main(String[] args) {
String[] fonts =
GraphicsEnvironment // GraphicsEnvironment(抽象类) 图形环境类
.getLocalGraphicsEnvironment() // 获取本地图形环境
.getAvailableFontFamilyNames(); // 获取可用字体family名

int fontCount = 0; // 字体数统计
for(String font : fonts) {
fontCount ++;
System.out.println(font);
}
System.out.println("系统字体数:" + fontCount);
}
}

package com.forget406.study;import java.awt.Font;import java.awt.GraphicsEnvironment;public class CustomeFontReading4 {    public static void main(String[] args) {                Font[] fonts = GraphicsEnvironment            .getLocalGraphicsEnvironment()                .getAllFonts();        for (Font font : fonts) {            System.out.println(font.getFontName());        }
System.out.println("字体数量:" + fonts.length); }}

如何字体优化