ewe.fx
Class Font

java.lang.Object
  extended byewe.fx.Font

public class Font
extends Object

Font is the character font used when drawing text on a surface.

Fonts have a name, such as "Helvetica", a style and a point size (usually around 10). It's important to note that many devices have an extremely limited number of fonts. For example, most PalmPilot devices have only two fonts: plain and bold. If the font specified can't be found during drawing, the closest matching font will be used.


Field Summary
static int BOLD
          A bold font style.
static int ITALIC
          An italic font style.
static int OUTLINE
          An outlined font style.
static int PLAIN
          A plain font style.
static int STRIKETHROUGH
          A strikethrough font style.
static int SUBSCRIPT
          A subscript font style.
static int SUPERSCRIPT
          A superscript font style.
static int UNDERLINE
          An underlined font style.
 
Constructor Summary
Font(String name, int style, int size)
          Creates a font of the given name, style and size.
 
Method Summary
 Font changeNameAndSize(String newName, int newSize)
          Change the name and/or size of a Font.
 Font changeStyle(int newStyle)
          Return a new Font with the same name and size, but a different style.
 boolean equals(Object other)
          Returns if this object is considered equal to the other object.
 String getName()
          Returns the name of the font.
 int getSize()
          Returns the size of the font.
 int getStyle()
          Returns the style of the font.
static String[] listFonts(ISurface surface)
          List the names of all the available fonts for a particular ISurface.
 String toString()
          Return a String representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode
 

Field Detail

PLAIN

public static final int PLAIN
A plain font style.

See Also:
Constant Field Values

BOLD

public static final int BOLD
A bold font style.

See Also:
Constant Field Values

ITALIC

public static final int ITALIC
An italic font style.

See Also:
Constant Field Values

UNDERLINE

public static final int UNDERLINE
An underlined font style.

See Also:
Constant Field Values

OUTLINE

public static final int OUTLINE
An outlined font style.

See Also:
Constant Field Values

STRIKETHROUGH

public static final int STRIKETHROUGH
A strikethrough font style.

See Also:
Constant Field Values

SUPERSCRIPT

public static final int SUPERSCRIPT
A superscript font style.

See Also:
Constant Field Values

SUBSCRIPT

public static final int SUBSCRIPT
A subscript font style.

See Also:
Constant Field Values
Constructor Detail

Font

public Font(String name,
            int style,
            int size)
Creates a font of the given name, style and size. Font styles are defined in this class.

See Also:
PLAIN, BOLD, Graphics
Method Detail

getName

public String getName()
Returns the name of the font.


getSize

public int getSize()
Returns the size of the font.


getStyle

public int getStyle()
Returns the style of the font. Font styles are defined in this class.

See Also:
PLAIN, BOLD

changeStyle

public Font changeStyle(int newStyle)
Return a new Font with the same name and size, but a different style.

Parameters:
newStyle - The new style for the Font.
Returns:
A new Font (or the same font if the style is the same).

changeNameAndSize

public Font changeNameAndSize(String newName,
                              int newSize)
Change the name and/or size of a Font.

Parameters:
newName - The newName for the Font. If it is null the old name is used.
newSize - The newSize for the Font. If it is <= 0, the old size is used.
Returns:
A new Font.

listFonts

public static String[] listFonts(ISurface surface)
List the names of all the available fonts for a particular ISurface.


toString

public String toString()
Description copied from class: Object
Return a String representation of this object.

Overrides:
toString in class Object
Returns:
a String representing this object.

equals

public boolean equals(Object other)
Description copied from class: Object
Returns if this object is considered equal to the other object.

Overrides:
equals in class Object
Parameters:
other - Another object to compare to.
Returns:
true if this object is considered equal to the other object.