nextapp.echo
Class Font

java.lang.Object
  extended by nextapp.echo.Font
All Implemented Interfaces:
java.io.Serializable

public class Font
extends java.lang.Object
implements java.io.Serializable

A representation of a text font. Once created, a font is immutable.

See Also:
Serialized Form

Field Summary
static java.lang.String[] ARIAL
           
static int BOLD
          A style value indicating bold.
static java.lang.String[] HELVETICA
           
static int ITALIC
          A style value indicating bold.
static int LINE_THROUGH
          A style value indicating line-through.
static java.lang.String[] MONOSPACE
           
static int OVERLINE
          A style value indicating overline.
static int PLAIN
          A style value indicating no text attributes.
static java.lang.String[] SANS_SERIF
           
static java.lang.String[] SERIF
           
static java.lang.String[] TIMES
           
static java.lang.String[] TIMES_NEW_ROMAN
           
static java.lang.String[] TIMES_ROMAN
           
static int UNDERLINE
          A style value indicating underline.
static java.lang.String[] VERDANA
           
 
Constructor Summary
Font(java.lang.String[] names, int style, Extent sizeExtent)
          Creates a font with a primary and alternative typefaces, the given style attributes and size.
Font(java.lang.String[] names, int style, int size)
          Creates a font with a primary and alternative typefaces, the given style attributes and size.
Font(java.lang.String name, int style, int size)
          Creates a font with a single typeface, the given style attributes and size.
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true if this font is equivalent to the provided object.
 java.lang.String[] getNames()
          Returns the names of acceptable typefaces of this font, in preferential order.
 int getSize()
          Returns the size of the font, in points.
 Extent getSizeExtent()
          Returns the size of the font.
 int hashCode()
          Returns a hash code value for this font.
 boolean isBold()
          Returns whether the font is bold.
 boolean isItalic()
          Returns whether the font is italicized.
 boolean isLineThrough()
          Returns whether the font has line-through enabled.
 boolean isOverline()
          Returns whether the font has an overline.
 boolean isUnderline()
          Returns whether the font is underlined.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PLAIN

public static final int PLAIN
A style value indicating no text attributes.

See Also:
Constant Field Values

BOLD

public static final int BOLD
A style value indicating bold.

See Also:
Constant Field Values

ITALIC

public static final int ITALIC
A style value indicating bold.

See Also:
Constant Field Values

UNDERLINE

public static final int UNDERLINE
A style value indicating underline.

See Also:
Constant Field Values

OVERLINE

public static final int OVERLINE
A style value indicating overline.

See Also:
Constant Field Values

LINE_THROUGH

public static final int LINE_THROUGH
A style value indicating line-through.

See Also:
Constant Field Values

ARIAL

public static final java.lang.String[] ARIAL

HELVETICA

public static final java.lang.String[] HELVETICA

MONOSPACE

public static final java.lang.String[] MONOSPACE

SANS_SERIF

public static final java.lang.String[] SANS_SERIF

SERIF

public static final java.lang.String[] SERIF

TIMES

public static final java.lang.String[] TIMES

TIMES_NEW_ROMAN

public static final java.lang.String[] TIMES_NEW_ROMAN

TIMES_ROMAN

public static final java.lang.String[] TIMES_ROMAN

VERDANA

public static final java.lang.String[] VERDANA
Constructor Detail

Font

public Font(java.lang.String name,
            int style,
            int size)
Creates a font with a single typeface, the given style attributes and size. Use of this constructor is not recommended, as it does not provide for alternative fonts in the event the client does not support the application's ideal font choice.

Parameters:
name - The font name. This font name must be available on the client computer or the use of this font may not have any effect.
style - The style of the font, one or more of the following values:
  • PLAIN
  • BOLD
  • ITALIC
  • UNDERLINE
If it is necessary create a font with multiple style attributes, they should be bitwise-ORed together, using an expression such as BOLD | UNDERLINE.
size - The point size of the font.

Font

public Font(java.lang.String[] names,
            int style,
            int size)
Creates a font with a primary and alternative typefaces, the given style attributes and size.

Parameters:
names - An array of font names. The client will use the font with the lowest index in the array that it supports to display text. It is recommended that an application provide either "Sans-Serif", "Serif", or "Monospace" as the last element of this array, as these fonts will be supported by all clients.
style - The style of the font, one or more of the following values:
  • PLAIN
  • BOLD
  • ITALIC
  • UNDERLINE
If it is necessary create a font with multiple style attributes, they should be bitwise-ORed together, using an expression such as BOLD | UNDERLINE.
size - The point size of the font.

Font

public Font(java.lang.String[] names,
            int style,
            Extent sizeExtent)
Creates a font with a primary and alternative typefaces, the given style attributes and size.

Parameters:
names - An array of font names. The client will use the font with the lowest index in the array that it supports to display text. It is recommended that an application provide either "Sans-Serif", "Serif", or "Monospace" as the last element of this array, as these fonts will be supported by all clients.
style - The style of the font, one or more of the following values:
  • PLAIN
  • BOLD
  • ITALIC
  • UNDERLINE
If it is necessary create a font with multiple style attributes, they should be bitwise-ORed together, using an expression such as BOLD | UNDERLINE.
sizeExtent - The size of the font as a Extent.
Method Detail

equals

public boolean equals(java.lang.Object o)
Returns true if this font is equivalent to the provided object.

Overrides:
equals in class java.lang.Object
Returns:
True if this font is equivalent to the provided object.

getNames

public java.lang.String[] getNames()
Returns the names of acceptable typefaces of this font, in preferential order.


getSize

public int getSize()
Returns the size of the font, in points.

Returns:
The size of the font, in points.

getSizeExtent

public Extent getSizeExtent()
Returns the size of the font.

Returns:
The size of the font.

hashCode

public int hashCode()
Returns a hash code value for this font.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code value for this font.

isBold

public boolean isBold()
Returns whether the font is bold.

Returns:
True if the font is bold.

isItalic

public boolean isItalic()
Returns whether the font is italicized.

Returns:
True if the font is italicized.

isLineThrough

public boolean isLineThrough()
Returns whether the font has line-through enabled.

Returns:
True if the font has line-through enabled.

isOverline

public boolean isOverline()
Returns whether the font has an overline.

Returns:
True if the font has an overline.

isUnderline

public boolean isUnderline()
Returns whether the font is underlined.

Returns:
True if the font is underlined.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()