public final class FontHelper
extends java.lang.Object
FontHelper class is used for caching all style
variations of a single font, such as plain or bold, from a single
family and font size. | Constructor and Description |
|---|
FontHelper(java.lang.String fontFamily,
int fontSize)
Construct a new
FontHelper using the specified
base font family and font size. |
| Modifier and Type | Method and Description |
|---|---|
java.awt.Font |
getBaseFont()
Fetches the current base font for the font helper.
|
java.awt.Font |
getFont(int fontStyle)
Fetches the font in the given style from the font helper.
|
java.awt.FontMetrics |
getFontMetrics(java.awt.Font font,
java.awt.Component component)
Retrieves the font metrics for the given font.
|
java.awt.FontMetrics |
getFontMetrics(int fontStyle,
java.awt.Component component)
Retrieves the font metrics for the given font style.
|
java.awt.Font |
setBaseFont(java.lang.String fontFamily,
int fontSize)
Sets the new base font for the font helper based on the given
family and font size.
|
public FontHelper(java.lang.String fontFamily,
int fontSize)
FontHelper using the specified
base font family and font size.fontFamily - the font family to usefontSize - the font size to usepublic java.awt.Font setBaseFont(java.lang.String fontFamily,
int fontSize)
fontFamily - the font family to usefontSize - the font size to usepublic java.awt.Font getBaseFont()
public java.awt.Font getFont(int fontStyle)
fontStyle - the font style to retrieve, such as Font.ITALICpublic java.awt.FontMetrics getFontMetrics(java.awt.Font font,
java.awt.Component component)
font - the font we are requesting metrics forcomponent - a UI component we can use for retrieving font metricspublic java.awt.FontMetrics getFontMetrics(int fontStyle,
java.awt.Component component)
fontStyle - the font style to get the metrics forcomponent - a UI component we can use for retrieving font metrics