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. |
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.height
- The height of the font.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.fontName
- the font namefontMetricsProps
- the property object holding the details of this
particular font.public int getStringWidth(java.lang.String str)
str
- The string to measure.Copyright 2021 The Apache Software Foundation or its licensors, as applicable.