public final class Font
extends java.lang.Object
/fontsize <size>
as argument,
before the application's name.
Modifier and Type | Field and Description |
---|---|
static int |
baseChar
For internal use only.
|
static int |
BIG_SIZE
A big-sized font (2 above the normal size)
|
static java.lang.String |
DEFAULT
The default font name.
|
FontMetrics |
fm |
java.lang.Object |
hv_UserFont |
static int |
MAX_FONT_SIZE
The maximum font size: 48 for Windows32, unlimited for OpenGL platforms (the number here will be 80,
since this is the size that the base font was created; you can specify something higher, but it will use
upscaling, which usually results in a smooth font).
|
static int |
MIN_FONT_SIZE
The minimum font size: 7.
|
java.lang.String |
name
Read only field that contains the font's name.
|
static int |
NORMAL_SIZE
A normal-sized font
|
int |
size
Read only field that contains the font's size.
|
int |
skiaIndex |
int |
style
Read only field that contains the font's style.
|
static int |
TAB_SIZE
When the vm draws a character and founds the tab char, it will draw a set of spaces.
|
Modifier and Type | Method and Description |
---|---|
Font |
adjustedBy(int delta)
Returns a font with the size changed with that delta.
|
Font |
adjustedBy(int delta,
boolean bold)
Returns a font with the size changed with that delta and the given bold style.
|
Font |
asBold()
Returns this font as Bold
|
static int |
getDefaultFontSize()
Returns the default font size, based on the screen's size.
|
static Font |
getFont(boolean boldStyle,
int size)
Gets the instance of the default font, with the given style and size.
|
static Font |
getFont(int size)
Gets the instance of the default font, normal style and with the given size.
|
static Font |
getFont(java.lang.String name,
boolean boldStyle,
int size)
Gets the instance of a font of the given name, style and size.
|
boolean |
isBold()
Returns if this font is bold.
|
Font |
percentBy(int percent)
Returns a font with the size changed with that percentage.
|
Font |
percentBy(int percent,
boolean bold)
Returns a font with the size changed with that percentage and the given bold style.
|
void |
removeFromCache()
Used internally.
|
void |
removeFromCache4D() |
java.lang.String |
toString() |
public java.lang.String name
public int style
public int size
public java.lang.Object hv_UserFont
public FontMetrics fm
public int skiaIndex
public static final java.lang.String DEFAULT
public static int MIN_FONT_SIZE
public static int MAX_FONT_SIZE
public static int baseChar
public static final int NORMAL_SIZE
public static final int BIG_SIZE
public static int TAB_SIZE
public static int getDefaultFontSize()
public static Font getFont(boolean boldStyle, int size)
boldStyle
- If true, a bold font is used. Otherwise, a plain font is used.size
- If you want a text bigger than the standard size, use Font.NORMAL_SIZE+x; or if you want
a text smaller than the standard size, use Font.NORMAL_SIZE-x. Size is adjusted to be in the range
Font.MIN_FONT_SIZE ... Font.MAX_FONT_SIZE
. That is, passing a value out of the bounds
won't throw an exception, will only use the minimum default size if the size passed is less than it or
use the maximum default size if the size passed is greater than it.public static Font getFont(int size)
boldStyle
- If true, a bold font is used. Otherwise, a plain font is used.size
- If you want a text bigger than the standard size, use Font.NORMAL_SIZE+x; or if you want
a text smaller than the standard size, use Font.NORMAL_SIZE-x. Size is adjusted to be in the range
Font.MIN_FONT_SIZE ... Font.MAX_FONT_SIZE
. That is, passing a value out of the bounds
won't throw an exception, will only use the minimum default size if the size passed is less than it or
use the maximum default size if the size passed is greater than it.public static Font getFont(java.lang.String name, boolean boldStyle, int size)
name
- Font.DEFAULT is the default font. You must install other fonts if you want to use them.boldStyle
- If true, a bold font is used. Otherwise, a plain font is used.size
- If you want a text bigger than the standard size, use Font.NORMAL_SIZE+x; or if you want
a text smaller than the standard size, use Font.NORMAL_SIZE-x. Size is adjusted to be in the range
Font.MIN_FONT_SIZE ... Font.MAX_FONT_SIZE
. That is, passing a value out of the bounds won't throw an exception,
will only use the minimum default size if the size passed is less than it or use the maximum default size if the size passed is
greater than it.public Font asBold()
public Font adjustedBy(int delta)
public Font adjustedBy(int delta, boolean bold)
public Font percentBy(int percent)
public Font percentBy(int percent, boolean bold)
public boolean isBold()
public void removeFromCache()
public void removeFromCache4D()
public java.lang.String toString()
toString
in class java.lang.Object