public class FontDetails extends Object
Constructor and Description |
---|
FontDetails(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 String |
buildFontCharactersProperty(String fontName) |
protected static String |
buildFontHeightProperty(String fontName) |
protected static String |
buildFontWidthsProperty(String fontName) |
static FontDetails |
create(String fontName,
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.
|
String |
getFontName() |
int |
getHeight() |
int |
getStringWidth(String str)
Gets the width of all characters in a string.
|
public FontDetails(String fontName, int height)
fontName
- The font name.height
- The height of the font.public String getFontName()
public int getHeight()
public void addChar(char c, int width)
public int getCharWidth(char c)
public void addChars(char[] characters, int[] widths)
public static FontDetails create(String fontName, 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(String str)
str
- The string to measure.Copyright © 2020. All rights reserved.