Package ro.sync.exml.view.graphics
Class Font
java.lang.Object
ro.sync.exml.view.graphics.Font
Font common class.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newFontfrom the specified name, style and point size.Creates a newFontfrom the specified name, style and point size.Creates a newFontfrom the specified name, style and point size. -
Method Summary
Modifier and TypeMethodDescriptionstatic FontdecodeFont(String value) Decodes a font property value, having the format "name,style,size"static StringencodeFont(Font font) Encodes a font as: "name,style,size"booleanChecks if the two colors have the same RGB value.String[]Get the array of font names.intGet the letter spacing.getName()intgetSize()intgetStyle()hash()static final StringHash the fontstatic final StringHash the fontstatic final StringHash the fontinthashCode()booleanisBold()Indicates whether or not thisFontobject's style is BOLD.booleanisItalic()Indicates whether or not thisFontobject's style is ITALIC.booleanisPlain()Indicates whether or not thisFontobject's style is PLAIN.toString()Converts thisFontobject to aStringrepresentation.
-
Field Details
-
PLAIN
public static final int PLAINThe plain style constant.- See Also:
-
BOLD
public static final int BOLDThe bold style constant. This can be combined with the other style constants (except PLAIN) for mixed styles.- See Also:
-
ITALIC
public static final int ITALICThe italicized style constant. This can be combined with the other style constants (except PLAIN) for mixed styles.- See Also:
-
-
Constructor Details
-
Font
Creates a newFontfrom the specified name, style and point size.- Parameters:
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. Ifnameisnull, thenameof the newFontis set to the name "Default".style- the style constant for theFontThe 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 theFont
-
Font
Creates a newFontfrom the specified name, style and point size.- Parameters:
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. Ifnameisnull, thenameof the newFontis set to the name "Default".style- the style constant for theFontThe 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 theFontletterSpacing- MThe amount of advance pixels. Default is "0".
-
Font
Creates a newFontfrom the specified name, style and point size.- Parameters:
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. Ifnameisnull, thenameof the newFontis set to the name "Default".style- the style constant for theFontThe 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 theFontletterSpacing- 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.
-
-
Method Details
-
getName
- Returns:
- The name
-
getSize
public int getSize()- Returns:
- The size
-
getStyle
public int getStyle()- Returns:
- The style
-
getLetterSpacing
public int getLetterSpacing()Get the letter spacing.- Returns:
- Returns the letterSpacing.
-
toString
Converts thisFontobject to aStringrepresentation. -
isPlain
public boolean isPlain()Indicates whether or not thisFontobject's style is PLAIN.- Returns:
trueif thisFonthas a PLAIN sytle;falseotherwise.- See Also:
-
isBold
public boolean isBold()Indicates whether or not thisFontobject's style is BOLD.- Returns:
trueif thisFontobject's style is BOLD;falseotherwise.- See Also:
-
isItalic
public boolean isItalic()Indicates whether or not thisFontobject's style is ITALIC.- Returns:
trueif thisFontobject's style is ITALIC;falseotherwise.- See Also:
-
hash
- Returns:
- A hash of the font
-
hash
Hash the font- Parameters:
name- The the font main family onestyle- Stylesize- Size- Returns:
- The hash
-
hash
Hash the font- Parameters:
fontFamily- The the font main family onestyle- Stylesize- SizeletterSpacing- Letter spacing in pixels- Returns:
- The hash
-
hash
Hash the font- Parameters:
fontNames- The list of font names, the main one and the fallback ones.style- Stylesize- SizeletterSpacing- Letter spacing in pixels- Returns:
- The hash
-
equals
Checks if the two colors have the same RGB value. The alpha is also taken into account. -
hashCode
public int hashCode() -
encodeFont
Encodes a font as: "name,style,size"- Parameters:
font- The font to be encoded.- Returns:
- The encoded value.
-
decodeFont
Decodes a font property value, having the format "name,style,size"- Parameters:
value- The value to be decoded.- Returns:
- The font.
-
getFontNames
Get the array of font names. 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.- Returns:
- The entire list of font names, including the main one (on the first position), and the fallback ones.
-