public class FontDetails
extends java.lang.Object
Constructor and Description |
---|
FontDetails(java.lang.String fontName, int height)
Construct the font details with the given name and height.
|
Modifier and Type | Method and Description |
---|---|
void |
addChar(char c, int width) |
void |
addChars(char[] characters, int[] widths) |
protected static java.lang.String |
buildFontCharactersProperty(java.lang.String fontName) |
protected static java.lang.String |
buildFontHeightProperty(java.lang.String fontName) |
protected static java.lang.String |
buildFontWidthsProperty(java.lang.String fontName) |
static FontDetails |
create(java.lang.String fontName, java.util.Properties fontMetricsProps)
Create an instance of
FontDetails by loading them from the provided property object.
(通过从提供的属性对象加载它们来创建 FontDetails 的实例。)
|
int |
getCharWidth(char c)
Retrieves the width of the specified character.
(检索指定字符的宽度。)
|
java.lang.String |
getFontName() |
int |
getHeight() |
int |
getStringWidth(java.lang.String str)
Gets the width of all characters in a string.
(获取字符串中所有字符的宽度。)
|
public FontDetails(java.lang.String fontName, int height)
fontName
- The font name.
(fontName - 字体名称。)
height
- The height of the font.
(height - 字体的高度。)
public java.lang.String getFontName()
public int getHeight()
public void addChar(char c, int width)
public int getCharWidth(char c)
public void addChars(char[] characters, int[] widths)
protected static java.lang.String buildFontHeightProperty(java.lang.String fontName)
protected static java.lang.String buildFontWidthsProperty(java.lang.String fontName)
protected static java.lang.String buildFontCharactersProperty(java.lang.String fontName)
public static FontDetails create(java.lang.String fontName, java.util.Properties fontMetricsProps)
FontDetails
by loading them from the provided property object.
(通过从提供的属性对象加载它们来创建 FontDetails 的实例。)
fontName
- the font name
(fontName - 字体名称)
fontMetricsProps
- the property object holding the details of this particular font.
(fontMetricsProps - 保存此特定字体详细信息的属性对象。)
public int getStringWidth(java.lang.String str)
str
- The string to measure.
(str - 要测量的字符串。)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.