|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graphics.FontFormat
FontFormat represents a format for fonts. This format consists of
the following attributes:
The family attribute defines the font family. The family of the font is sometimes also called the name of the font. The available families are system dependent because each system has installed its own fonts. This may even differ between several installations of the same system.
The size attribute defines the size of the font. This value is not given in device coordinates. Moreover it is dependent on the context the font lies within.
The weight attribute defines the weight the font is drawn with. At the actual
state of development the font supports only the NORMAL (or PLAIN)
and BOLD weights.
The color attribute defines the color the font is drawn with. The color is
represented by an int that defines the values for the red, green
and blue components as illustrated by the following hexadecimal pattern:
0x00rrggbb
where rr stands for the red component, gg stands for
the green component and bb stands for the blue component of the color.
The italic flag indicates whether the font is illustrated italic or not.
The underlined flag indicates whether the font has a line below each letter or not.
The strikethrough flag indicates whether each letter is crossed by a line or not.
Since the FontFormat is an object that is frequently used
within the graphics framework and all frameworks that use the
graphics framework FontFormats are subject of
pooling. The pooling of the FontFormat instances is being done
by the FormatPool. To get more informations about this class
take a look at the documentation about the FormatPool.
In order to pool a FontFormat it has to be immutable because
maybe many objects have a reference on the same FontFormat and
modifying the FontFormat will affect all these objects.
For the pooling also an unique expression is needed so that a
FontFormat can be surely identified. The unique expression is
called the canonical description. This canonical description is made up of
the attributes a FontFormat consists of and it can be gained
by Format.getCanonicalDescription().
A FontFormat can only be created by using the
FormatPool.parseFontFormat(String) method to
ensure a correct pooling behavior. You can obtain the canonical description
by calling the on of the static methods called getCanonicalDescription().
A FontFormat is usually applied to a Primitive
(e.g. Label2D) by calling the
Primitive.setFontFormat(FontFormat) method.
A FontFormat consists of the following attributes:
THIN
to NORMAL to HEAVY. At the time
of writing, only the THIN and NORMAL
weights are supported.
0x00rrggbb presented before.
| Field Summary | |
static int |
BOLD
The weights a FontFormat supports. |
protected static java.lang.String |
CANONIC_DESCRIPTION_DELIMITER
Delimitier for the canonical description. |
protected static java.lang.String |
CANONIC_DESCRIPTION_SUBDESC_END
End token for a description in a sublevel. |
protected static java.lang.String |
CANONIC_DESCRIPTION_SUBDESC_START
Start token for a description in a sublevel. |
static java.lang.String |
DEFAULT_FAMILY
Default font family of a FontFormat. |
static FontFormat |
DEFAULT_FONT_FORMAT
Default font format. |
static int |
DEFAULT_SIZE
Default size of a FontFormat. |
static int |
EXTRABOLD
The weights a FontFormat supports. |
static int |
EXTRALIGHT
The weights a FontFormat supports. |
static int |
HEAVY
The weights a FontFormat supports. |
static int |
LIGHT
The weights a FontFormat supports. |
static int |
MEDIUM
The weights a FontFormat supports. |
static int |
NONE
The weights a FontFormat supports. |
static int |
NORMAL
The weights a FontFormat supports. |
static int |
SEMIBOLD
The weights a FontFormat supports. |
static int |
THIN
The weights a FontFormat supports. |
protected static java.lang.String |
TOKEN_COLOR
Enumeration that tells about the canonical description tokens. |
protected static java.lang.String |
TOKEN_FAMILY
Enumeration that tells about the canonical description tokens. |
protected static java.lang.String |
TOKEN_ITALIC
Enumeration that tells about the canonical description tokens. |
protected static java.lang.String |
TOKEN_SIZE
Enumeration that tells about the canonical description tokens. |
protected static java.lang.String |
TOKEN_STRIKETHROUGH
Enumeration that tells about the canonical description tokens. |
protected static java.lang.String |
TOKEN_STRIKETHROUGHSTROKE
Enumeration that tells about the canonical description tokens. |
protected static java.lang.String |
TOKEN_UNDERLINE
Enumeration that tells about the canonical description tokens. |
protected static java.lang.String |
TOKEN_UNDERLINESTROKE
Enumeration that tells about the canonical description tokens. |
protected static java.lang.String |
TOKEN_WEIGHT
Enumeration that tells about the canonical description tokens. |
| Method Summary | |
boolean |
equals(java.lang.Object o)
|
boolean |
getBold()
Returns a boolean that indicates whether the font is
BOLD or not. |
java.lang.String |
getCanonicalDescription()
Returns the canonical description of a FontFormat. |
static java.lang.String |
getCanonicalDescription(int size,
int weight,
java.lang.String family,
int color,
boolean italic,
boolean underline,
boolean strikethrough)
Returns the canonical description of a FontFormat. |
static java.lang.String |
getCanonicalDescription(int size,
int weight,
java.lang.String family,
int color,
boolean italic,
boolean underline,
boolean strikethrough,
StrokeFormat underlineStroke,
StrokeFormat strikethroughStroke)
Returns the canonical description of a FontFormat. |
static java.lang.String |
getCanonicalDescription(java.lang.String size,
java.lang.String weight,
java.lang.String family,
java.lang.String color,
java.lang.String italic,
java.lang.String underline,
java.lang.String strikethrough)
Returns the canonical description of a FontFormat. |
static java.lang.String |
getCanonicalDescription(java.lang.String size,
java.lang.String weight,
java.lang.String family,
java.lang.String color,
java.lang.String italic,
java.lang.String underline,
java.lang.String strikethrough,
java.lang.String underlineStroke,
java.lang.String strikethroughStroke)
Returns the canonical description of a FontFormat. |
int |
getColor()
Returns the color of the font. |
java.lang.String |
getFamily()
Returns a String that represents the family of the font. |
java.lang.Object[] |
getFormatData()
Returns an array filled with the attributes of the FontFormat. |
boolean |
getItalic()
Returns a boolean that indicates whether the font is italic
or not. |
int |
getSize()
Returns the size of the font |
boolean |
getStrikethrough()
Returns a boolean that indicates whether the font is
striketrough or not. |
StrokeFormat |
getStrikethroughStroke()
Returns the stroke format that should be used for strikethroughs |
boolean |
getUnderline()
Returns a boolean that indicates whether the font is
underlined or not. |
StrokeFormat |
getUnderlineStroke()
Returns the stroke format that should be used for underlines |
int |
getWeight()
Retuns a constant that represents the weight of the font. |
int |
hashCode()
|
boolean |
isVisible()
Returns a boolean that indicates whether the font is visible
or not. |
java.lang.String |
toString()
Returns a String that represent the FontFormat
and all of the attributes of it. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int NONE
FontFormat supports.
public static final int THIN
FontFormat supports.
public static final int EXTRALIGHT
FontFormat supports.
public static final int LIGHT
FontFormat supports.
public static final int NORMAL
FontFormat supports.
public static final int MEDIUM
FontFormat supports.
public static final int SEMIBOLD
FontFormat supports.
public static final int BOLD
FontFormat supports.
public static final int EXTRABOLD
FontFormat supports.
public static final int HEAVY
FontFormat supports.
public static final int DEFAULT_SIZE
FontFormat.
public static final java.lang.String DEFAULT_FAMILY
FontFormat.
public static final FontFormat DEFAULT_FONT_FORMAT
protected static final java.lang.String CANONIC_DESCRIPTION_DELIMITER
protected static final java.lang.String CANONIC_DESCRIPTION_SUBDESC_START
protected static final java.lang.String CANONIC_DESCRIPTION_SUBDESC_END
protected static final java.lang.String TOKEN_SIZE
protected static final java.lang.String TOKEN_WEIGHT
protected static final java.lang.String TOKEN_FAMILY
protected static final java.lang.String TOKEN_COLOR
protected static final java.lang.String TOKEN_ITALIC
protected static final java.lang.String TOKEN_UNDERLINE
protected static final java.lang.String TOKEN_STRIKETHROUGH
protected static final java.lang.String TOKEN_UNDERLINESTROKE
protected static final java.lang.String TOKEN_STRIKETHROUGHSTROKE
| Method Detail |
public int getSize()
public int getWeight()
NORMAL and BOLD are supported.
public java.lang.String getFamily()
String that represents the family of the font.
public int getColor()
int that defines the values for the red, green and
blue components as illustrated by the following hexadecimal pattern:
public boolean getBold()
boolean that indicates whether the font is
BOLD or not.
public boolean getItalic()
boolean that indicates whether the font is italic
or not.
public boolean getUnderline()
boolean that indicates whether the font is
underlined or not. Notice that at the actual state of development
underlined fonts are not supported.
public boolean getStrikethrough()
boolean that indicates whether the font is
striketrough or not. Notice that at the actual state of development
strikethrough fonts are not supported.
public boolean isVisible()
boolean that indicates whether the font is visible
or not. Notice that at the actual state of development invisible fonts
are not supported.
public java.lang.Object[] getFormatData()
FontFormat. The indices of the attributes are given by
constants defined in this class. This array is used by
Renderers and Devices. To get more informations
about this objects take a look at the documentation of
Renderer and
Device
FontFormatpublic java.lang.String getCanonicalDescription()
FontFormat. For
instance this description is used for the pooling of
FontFormats. It can also be used to compare two instances
of a FontFormat.
getCanonicalDescription in interface FormatFontFormatpublic java.lang.String toString()
String that represent the FontFormat
and all of the attributes of it. For instance this representation can be
used for tracing purposes and such.
toString in interface FormatFontFormatpublic int hashCode()
public boolean equals(java.lang.Object o)
public static final java.lang.String getCanonicalDescription(int size,
int weight,
java.lang.String family,
int color,
boolean italic,
boolean underline,
boolean strikethrough)
FontFormat. For
instance this description is used for the pooling of
FontFormats. It can also be used to compare two instances
of a FontFormat.
size - the size of a FontFormatweight - the weight of a FontFormatfamily - the family of a FontFormatcolor - the color of a FontFormatitalic - the italic indicator of a FontFormatunderline - the underline indicator of a FontFormatstrikethrough - the strikethrough indicator of a
FontFormat
FontFormat
public static final java.lang.String getCanonicalDescription(int size,
int weight,
java.lang.String family,
int color,
boolean italic,
boolean underline,
boolean strikethrough,
StrokeFormat underlineStroke,
StrokeFormat strikethroughStroke)
FontFormat. For
instance this description is used for the pooling of
FontFormats. It can also be used to compare two instances
of a FontFormat.
size - the size of a FontFormatweight - the weight of a FontFormatfamily - the family of a FontFormatcolor - the color of a FontFormatitalic - the italic indicator of a FontFormatunderline - the underline indicator of a FontFormatstrikethrough - the strikethrough indicator of a
FontFormatunderlineStroke - strikethroughStroke -
FontFormat
public static final java.lang.String getCanonicalDescription(java.lang.String size,
java.lang.String weight,
java.lang.String family,
java.lang.String color,
java.lang.String italic,
java.lang.String underline,
java.lang.String strikethrough)
FontFormat. For
instance this description is used for the pooling of
FontFormats. It can also be used to compare two instances
of a FontFormat.
null
size - the size of a FontFormatweight - the weight of a FontFormatfamily - the family of a FontFormatcolor - the color of a FontFormatitalic - the italic indicator of a FontFormatunderline - the underline indicator of a FontFormatstrikethrough - the strikethrough indicator of a
FontFormat
FontFormat
public static final java.lang.String getCanonicalDescription(java.lang.String size,
java.lang.String weight,
java.lang.String family,
java.lang.String color,
java.lang.String italic,
java.lang.String underline,
java.lang.String strikethrough,
java.lang.String underlineStroke,
java.lang.String strikethroughStroke)
FontFormat. For
instance this description is used for the pooling of
FontFormats. It can also be used to compare two instances
of a FontFormat.
null
size - the size of a FontFormatweight - the weight of a FontFormatfamily - the family of a FontFormatcolor - the color of a FontFormatitalic - the italic indicator of a FontFormatunderline - the underline indicator of a FontFormatstrikethrough - the strikethrough indicator of a
FontFormatunderlineStroke - The stroke to use for the underlinestrikethroughStroke - The stroke to use for the strikethrough
FontFormatpublic StrokeFormat getUnderlineStroke()
public StrokeFormat getStrikethroughStroke()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||