java.lang.Object | |
↳ | com.neomades.graphics.Font |
Text Font.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | STYLE_BLACK | ||||||||||
int | STYLE_BOLD | The bold style constant | |||||||||
int | STYLE_EXTRA_BLACK | ||||||||||
int | STYLE_EXTRA_BOLD | ||||||||||
int | STYLE_EXTRA_LIGHT | ||||||||||
int | STYLE_ITALIC | The italic style constant | |||||||||
int | STYLE_LIGHT | ||||||||||
int | STYLE_MEDIUM | ||||||||||
int | STYLE_PLAIN | The plain style constant | |||||||||
int | STYLE_SEMI_BOLD | ||||||||||
int | STYLE_THIN |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static final Font | DEFAULT | Retrieves the default Font |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int |
charWidth(char character)
Gets the advance width of the specified character in this Font.
| ||||||||||
static Font |
createFont(Font font, int style, int size)
Creates a new font based on the font given in parameter.
| ||||||||||
static Font |
createFont(Font font, int style)
Creates a new font based on the font given in parameter.
| ||||||||||
abstract String | getName() | ||||||||||
int |
getSize()
Returns the size of the font
| ||||||||||
int |
getStyle()
Returns the style of the font, which is a combination of the constants
defined in this class
| ||||||||||
boolean |
isBold()
Returns true if the font is bold
| ||||||||||
boolean |
isItalic()
Returns true if the font is italic
| ||||||||||
int |
stringWidth(String text)
Gets the advance width of the specified text in this Font.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
The bold style constant
The italic style constant
The plain style constant
Gets the advance width of the specified character in this Font.
character | the character to be measured |
---|
Creates a new font based on the font given in parameter.
Some system fonts could not support some styles like
STYLE_ITALIC
. Some combinations of style may not be supported
depending of the platform. For example, on iOS, the STYLE_BOLD and
STYLE_ITALIC style constants can not be used together.
Three sizes will be adapted by each device because all devices have different size in pixels for theses 3 fonts.
font | the font to duplicate |
---|---|
style | the new style of the font (a combination of the STYLE_* constants) |
size | the new size of the font |
Creates a new font based on the font given in parameter.
Some system fonts could not support some styles like STYLE_ITALIC
.
Some combinations of style may not be supported depending of the platform.
For example, on iOS, the STYLE_BOLD and STYLE_ITALIC style constants
can not be used together.
font | the font to duplicate |
---|---|
style | the new style of the font (a combination of the STYLE_* constants) |
Returns the size of the font
Returns the style of the font, which is a combination of the constants defined in this class
Returns true if the font is bold
Returns true if the font is italic
Gets the advance width of the specified text in this Font.
text | the String to be measured |
---|