public class FontMetrics
extends java.lang.Object
Only supports Helvetica font.
| Constructor and Description |
|---|
FontMetrics() |
| Modifier and Type | Method and Description |
|---|---|
static double |
getAscender(int fontSize)
Distance between baseline and top of highest letter.
|
static double |
getDescender(int fontSize)
Distance between baseline and bottom of letter extending the farest below the baseline.
|
static double |
getLeading(int fontSize)
Extra space between descender of text line and ascender of next line.
|
static double |
getLineHeight(int fontSize)
Distance between the baselines of the consecutive text lines.
|
static java.lang.String[] |
splitLines(java.lang.String text,
double maxLength,
int fontSize)
Splits the text into lines.
|
public static double getAscender(int fontSize)
fontSize - the font size (in pt)public static double getDescender(int fontSize)
fontSize - the font size (in pt)public static double getLeading(int fontSize)
fontSize - the font size (in pt)public static double getLineHeight(int fontSize)
fontSize - the font size (in pt)public static java.lang.String[] splitLines(java.lang.String text,
double maxLength,
int fontSize)
If a line would exceed the specified maximum length, line breaks are inserted. Newlines are treated as fixed line breaks.
text - the textmaxLength - the maximum line length (in pt)fontSize - the font size (in pt)