public class FontUtil extends Object
| Constructor and Description |
|---|
FontUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Font |
createFont()
创建默认字体
|
static Font |
createFont(File fontFile)
|
static Font |
createFont(InputStream fontStream)
|
static Font |
createFont(String name,
int size)
创建指定名称的字体
|
static Font |
createSansSerifFont(int size)
创建SansSerif字体
|
static Dimension |
getDimension(FontMetrics metrics,
String str)
获得字体对应字符串的长宽信息
|
public static Font createFont()
public static Font createSansSerifFont(int size)
size - 字体大小public static Font createFont(String name, int size)
name - 字体名称size - 字体大小public static Font createFont(InputStream fontStream)
fontStream - 字体流Fontpublic static Dimension getDimension(FontMetrics metrics, String str)
metrics - FontMetricsstr - 字符串Copyright © 2025. All rights reserved.