edu.northwestern.at.wordhoard.swing.text
Class FontInfoImpl

java.lang.Object
  extended by edu.northwestern.at.wordhoard.swing.text.FontInfoImpl
All Implemented Interfaces:
FontInfo

public class FontInfoImpl
extends java.lang.Object
implements FontInfo

Font information.

On the Mac we give the "Times" font two pixels of additional spacing between lines.


Constructor Summary
FontInfoImpl(java.awt.Font font)
          Creates a new font information object.
FontInfoImpl(java.lang.String family, int style, int size)
          Creates a new font information object.
 
Method Summary
 int getAscent()
          Gets the ascent.
 int getDescent()
          Gets the descent.
 java.awt.Font getFont()
          Gets the font.
 int getHeight()
          Gets the line height.
 int getLeading()
          Gets the leading.
 int stringWidth(java.lang.String str)
          Gets the width of a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontInfoImpl

public FontInfoImpl(java.awt.Font font)
Creates a new font information object.

Parameters:
font - Font.

FontInfoImpl

public FontInfoImpl(java.lang.String family,
                    int style,
                    int size)
Creates a new font information object.

Parameters:
family - Family.
style - Style.
size - Size.
Method Detail

getFont

public java.awt.Font getFont()
Gets the font.

Specified by:
getFont in interface FontInfo
Returns:
The font.

getHeight

public int getHeight()
Gets the line height.

Specified by:
getHeight in interface FontInfo
Returns:
The line height in pixels.

getLeading

public int getLeading()
Gets the leading.

Specified by:
getLeading in interface FontInfo
Returns:
The leading in pixels.

getAscent

public int getAscent()
Gets the ascent.

Specified by:
getAscent in interface FontInfo
Returns:
The ascent in pixels.

getDescent

public int getDescent()
Gets the descent.

Specified by:
getDescent in interface FontInfo
Returns:
The descent in pixels.

stringWidth

public int stringWidth(java.lang.String str)
Gets the width of a string.

Specified by:
stringWidth in interface FontInfo
Parameters:
str - String.
Returns:
Width of the string in pixels.