public class Fonts extends Object
Modifier and Type | Method and Description |
---|---|
static int |
getHeight(Font font)
获取字体高度
|
static FontMetrics |
getMetrics(Font font)
获取字体指标
|
static int |
getStringWidth(char c,
Font font)
获取字符实际长度
|
static int |
getStringWidth(String s,
Font font)
获取字符传实际长度
|
static String[] |
getSupportedFonts()
获取系统支持的字体
|
static int[] |
getWidthHeightPixel(Graphics2D g2d,
Font font,
String s)
获取字体实际宽高
|
static int[] |
getWidthHeightPixel(Graphics2D g2d,
Font font,
String s,
int x,
int y)
获取字体实际宽高
|
public static FontMetrics getMetrics(Font font)
font
- fontpublic static int getStringWidth(char c, Font font)
c
- cfont
- fontpublic static int getStringWidth(String s, Font font)
s
- sfont
- fontpublic static int getHeight(Font font)
font
- fontpublic static String[] getSupportedFonts()
public static int[] getWidthHeightPixel(Graphics2D g2d, Font font, String s)
g2d
- g2dfont
- fonts
- spublic static int[] getWidthHeightPixel(Graphics2D g2d, Font font, String s, int x, int y)
g2d
- g2dfont
- fonts
- sx
- xy
- yCopyright © 2024. All rights reserved.