public class FontCalculator extends Object
Modifier and Type | Method and Description |
---|---|
float |
getAscent(Font font) |
float |
getAscentToHeight(String fontName,
int fontStyle,
float height) |
float |
getAspectRatio(Font font,
String text)
Returns the with of the given text divided by the height.
|
float |
getDescent(Font font) |
float |
getDescentToHeight(String fontName,
int fontStyle,
float height) |
float |
getHeight(Font font) |
static FontCalculator |
getInstance() |
float |
getWidth(Font font,
String text) |
float |
getWidthToHeigth(String fontName,
int fontStyle,
String text,
float height) |
public static FontCalculator getInstance()
public float getDescent(Font font)
public float getAspectRatio(Font font, String text)
getWidth() / getHeight()
although it
is calculated more efficiently.public float getWidthToHeigth(String fontName, int fontStyle, String text, float height)
public float getDescentToHeight(String fontName, int fontStyle, float height)
public float getAscentToHeight(String fontName, int fontStyle, float height)