|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.fx.FontTools
This class provides a set of static toolkit methods that work on Font and/or FontMetrics
| Field Summary | |
static int |
METRIC_ASCENT
A Metric value for getFontForMetric(). |
static int |
METRIC_DESCENT
A Metric value for getFontForMetric(). |
static int |
METRIC_HEIGHT
A Metric value for getFontForMetric(). |
static int |
METRIC_HEIGHT_OF_TEXT
A Metric value for getFontForMetric(). |
static int |
METRIC_WIDTH_OF_TEXT
A Metric value for getFontForMetric(). |
| Constructor Summary | |
FontTools()
|
|
| Method Summary | |
static Font |
fitInto(Dimension size,
Object data,
FontMetrics baseFont)
Find the biggest Font such that the data provided fits within the size provided. |
static Font |
getFontForHeight(int requiredHeight,
FontMetrics baseFont)
Find the biggest Font such that its height is less than or equal to the requiredHeight. |
static Font |
getFontForMetric(int valueOfMetricInPixels,
int whichMetric,
Object data,
FontMetrics baseFont)
Retrieve the Font which is of the correct size, such that its metric is equal to, or just smaller than the specified metric in pixels, or for which the metrics of the supplied data is equal to or just smaller than the specified metric in pixels. |
static int |
getMetricValue(int whichMetric,
Object data,
FontMetrics fm)
Get the value of a particular Metric for a FontMetrics for a set of data. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
public static final int METRIC_HEIGHT
public static final int METRIC_ASCENT
public static final int METRIC_DESCENT
public static final int METRIC_WIDTH_OF_TEXT
public static final int METRIC_HEIGHT_OF_TEXT
| Constructor Detail |
public FontTools()
| Method Detail |
public static int getMetricValue(int whichMetric,
Object data,
FontMetrics fm)
whichMetric - one of the METRIC_XXX valuesdata - This is only needed for METRIC_WIDTH_OF_TEXT or METRIC_HEIGHT_OF_TEXT.
The data must be a String, an array of Strings (which is assumed will be placed one above the other)
or a Character (for a single character).fm - The FontMetrics to use.
public static Font getFontForMetric(int valueOfMetricInPixels,
int whichMetric,
Object data,
FontMetrics baseFont)
valueOfMetricInPixels - The value of the metrics in Pixels.whichMetric - one of the METRIC_XXX valuesdata - This is only needed for METRIC_WIDTH_OF_TEXT or METRIC_HEIGHT_OF_TEXT.
The data must be a String, an array of Strings (which is assumed will be placed one above the other)
or a Character (for a single character).baseFont - The FontMetrics representing the base font to use. The returned Font will have the
same name and style as the baseFont.
public static Font fitInto(Dimension size,
Object data,
FontMetrics baseFont)
size - The size in pixels.data - This can be a Character or a String or an Array of Strings.baseFont - The FontMetrics representing the base font to use. The returned Font will have the
same name and style as the baseFont.
public static Font getFontForHeight(int requiredHeight,
FontMetrics baseFont)
requiredHeight - The required height for the Font.baseFont - The FontMetrics representing the base font to use. The returned Font will have the
same name and style as the baseFont.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||