@API(type=EXTENDABLE,
src=PRIVATE)
public class Font
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BOLD
The bold style constant.
|
static int |
ITALIC
The italicized style constant.
|
static int |
PLAIN
The plain style constant.
|
Constructor and Description |
---|
Font(java.lang.String name,
int style,
int size)
Creates a new
Font from the specified name, style and
point size. |
Font(java.lang.String name,
int style,
int size,
int letterSpacing)
Creates a new
Font from the specified name, style and
point size. |
Font(java.lang.String name,
int style,
int size,
int letterSpacing,
java.lang.String[] fontFamilies)
Creates a new
Font from the specified name, style and
point size. |
Modifier and Type | Method and Description |
---|---|
static Font |
decodeFont(java.lang.String value)
Decodes a font property value, having the format "name,style,size"
|
static java.lang.String |
encodeFont(Font font)
Encodes a font as: "name,style,size"
|
boolean |
equals(java.lang.Object obj)
Checks if the two colors have the same RGB value.
|
java.lang.String[] |
getFontNames()
Get the array of font names.
|
int |
getLetterSpacing()
Get the letter spacing.
|
java.lang.String |
getName() |
int |
getSize() |
int |
getStyle() |
java.lang.String |
hash() |
static java.lang.String |
hash(java.lang.String[] fontNames,
int style,
int size,
int letterSpacing)
Hash the font
|
static java.lang.String |
hash(java.lang.String name,
int style,
int size)
Hash the font
|
static java.lang.String |
hash(java.lang.String fontFamily,
int style,
int size,
int letterSpacing)
Hash the font
|
int |
hashCode() |
boolean |
isBold()
Indicates whether or not this
Font object's style is
BOLD. |
boolean |
isItalic()
Indicates whether or not this
Font object's style is
ITALIC. |
boolean |
isPlain()
Indicates whether or not this
Font object's style is
PLAIN. |
java.lang.String |
toString()
Converts this
Font object to a String
representation. |
public static final int PLAIN
public static final int BOLD
public static final int ITALIC
public Font(java.lang.String name, int style, int size)
Font
from the specified name, style and
point size.name
- the font name. This can be a logical font name or a
font face name. A logical name must be either: Dialog, DialogInput,
Monospaced, Serif, or SansSerif. If name
is
null
, the name
of the new
Font
is set to the name "Default".style
- the style constant for the Font
The style argument is an integer bitmask that may
be PLAIN, or a bitwise union of BOLD and/or ITALIC
(for example, ITALIC or BOLD|ITALIC).size
- the point size of the Font
public Font(java.lang.String name, int style, int size, int letterSpacing)
Font
from the specified name, style and
point size.name
- the font name. This can be a logical font name or a
font face name. A logical name must be either: Dialog, DialogInput,
Monospaced, Serif, or SansSerif. If name
is
null
, the name
of the new
Font
is set to the name "Default".style
- the style constant for the Font
The style argument is an integer bitmask that may
be PLAIN, or a bitwise union of BOLD and/or ITALIC
(for example, ITALIC or BOLD|ITALIC).size
- the point size of the Font
letterSpacing
- MThe amount of advance pixels. Default is "0".public Font(java.lang.String name, int style, int size, int letterSpacing, java.lang.String[] fontFamilies)
Font
from the specified name, style and
point size.name
- the font name. This can be a logical font name or a
font face name. A logical name must be either: Dialog, DialogInput,
Monospaced, Serif, or SansSerif. If name
is
null
, the name
of the new
Font
is set to the name "Default".style
- the style constant for the Font
The style argument is an integer bitmask that may
be PLAIN, or a bitwise union of BOLD and/or ITALIC
(for example, ITALIC or BOLD|ITALIC).size
- the point size of the Font
letterSpacing
- MThe amount of advance pixels. Default is "0".fontFamilies
- The array of font families. The first entry from the
array should be the same as the name parameter (the main font family name).
The next entries are fallback family names, used when the main font does
not support all the glyphs. This is cloned, for immutability.public java.lang.String getName()
public int getSize()
public int getStyle()
public int getLetterSpacing()
public java.lang.String toString()
Font
object to a String
representation.toString
in class java.lang.Object
String
representation of this
Font
object.public boolean isPlain()
Font
object's style is
PLAIN.true
if this Font
has a
PLAIN sytle;
false
otherwise.Font.getStyle()
public boolean isBold()
Font
object's style is
BOLD.true
if this Font
object's
style is BOLD;
false
otherwise.Font.getStyle()
public boolean isItalic()
Font
object's style is
ITALIC.true
if this Font
object's
style is ITALIC;
false
otherwise.Font.getStyle()
public java.lang.String hash()
public static final java.lang.String hash(java.lang.String name, int style, int size)
name
- The the font main family onestyle
- Stylesize
- Sizepublic static final java.lang.String hash(java.lang.String fontFamily, int style, int size, int letterSpacing)
fontFamily
- The the font main family onestyle
- Stylesize
- SizeletterSpacing
- Letter spacing in pixelspublic static final java.lang.String hash(java.lang.String[] fontNames, int style, int size, int letterSpacing)
fontNames
- The list of font names, the main one and the fallback ones.style
- Stylesize
- SizeletterSpacing
- Letter spacing in pixelspublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public static java.lang.String encodeFont(Font font)
font
- The font to be encoded.public static Font decodeFont(java.lang.String value)
value
- The value to be decoded.public java.lang.String[] getFontNames()
© Copyright SyncRO Soft SRL 2002 - 2016. All rights reserved.