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

java.lang.Object
  extended by edu.northwestern.at.wordhoard.swing.text.FontManager

public class FontManager
extends java.lang.Object

Font manager.

For each character set, three font family categories are used:

Windows should acquire a font manager in their constructor and use it to get all needed font and font information. Each new font manager gets a copy of the current user font family preferences. If the user changes these preferences, the changes only affect new windows, not windows that are already open.


Field Summary
static int MONOSPACED
          Monospaced font category.
static int NUM_CATEGORIES
          Number of font categories.
static int OTHER
          Other font category.
static int WORK
          Work font category.
 
Constructor Summary
FontManager()
          Creates a new font manager.
 
Method Summary
 java.awt.Font getFont(byte charset, int size)
          Gets a plain "other" font.
 java.awt.Font getFont(byte charset, int style, int size)
          Gets an "other" font.
 java.awt.Font getFont(int size)
          Gets a plain Roman "other" font.
 FontInfo getFontInfo(byte charset, int size)
          Gets plain "other" font info.
 FontInfo getFontInfo(byte charset, int style, int size)
          Gets "other" font info.
 FontInfo getFontInfo(int size)
          Gets plain Roman "other" font info.
 java.awt.Font getMonospacedFont(int size)
          Gets a plain monospaced font.
 java.awt.Font getMonospacedFont(int style, int size)
          Gets a monospaced font.
 FontInfo getMonospacedFontInfo(int size)
          Gets plain monospaced font info.
 FontInfo getMonospacedFontInfo(int style, int size)
          Gets monospaced font info.
 int getNominalLineHeight(byte charset)
          Gets the nominal line height.
 java.awt.Font getWorkFont(byte charset, int size)
          Gets a plain "work" font.
 java.awt.Font getWorkFont(byte charset, int style, int size)
          Gets a "work" font.
 FontInfo getWorkFontInfo(byte charset, int size)
          Gets plain "work" font info.
 FontInfo getWorkFontInfo(byte charset, int style, int size)
          Gets "work" font info.
 void initText(Text text)
          Initializes font information for text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WORK

public static final int WORK
Work font category.

See Also:
Constant Field Values

OTHER

public static final int OTHER
Other font category.

See Also:
Constant Field Values

MONOSPACED

public static final int MONOSPACED
Monospaced font category.

See Also:
Constant Field Values

NUM_CATEGORIES

public static final int NUM_CATEGORIES
Number of font categories.

See Also:
Constant Field Values
Constructor Detail

FontManager

public FontManager()
Creates a new font manager.

Method Detail

getWorkFontInfo

public FontInfo getWorkFontInfo(byte charset,
                                int style,
                                int size)
Gets "work" font info.

Parameters:
charset - Character set.
style - Style.
size - Size.
Returns:
Font info.

getWorkFontInfo

public FontInfo getWorkFontInfo(byte charset,
                                int size)
Gets plain "work" font info.

Parameters:
charset - Character set.
size - Size.
Returns:
Font info.

getFontInfo

public FontInfo getFontInfo(byte charset,
                            int style,
                            int size)
Gets "other" font info.

Parameters:
charset - Character set.
style - Style.
size - Size.
Returns:
Font info.

getFontInfo

public FontInfo getFontInfo(byte charset,
                            int size)
Gets plain "other" font info.

Parameters:
charset - Character set.
size - Size.
Returns:
Font info.

getFontInfo

public FontInfo getFontInfo(int size)
Gets plain Roman "other" font info.

Parameters:
size - Size.

getMonospacedFontInfo

public FontInfo getMonospacedFontInfo(int style,
                                      int size)
Gets monospaced font info.

Parameters:
style - Style.
size - Size.
Returns:
Font info.

getMonospacedFontInfo

public FontInfo getMonospacedFontInfo(int size)
Gets plain monospaced font info.

Parameters:
size - Size.
Returns:
Font info.

getWorkFont

public java.awt.Font getWorkFont(byte charset,
                                 int style,
                                 int size)
Gets a "work" font.

Parameters:
charset - Character set.
style - Style.
size - Size.
Returns:
Font.

getWorkFont

public java.awt.Font getWorkFont(byte charset,
                                 int size)
Gets a plain "work" font.

Parameters:
charset - Character set.
size - Size.
Returns:
Font.

getFont

public java.awt.Font getFont(byte charset,
                             int style,
                             int size)
Gets an "other" font.

Parameters:
charset - Character set.
style - Style.
size - Size.
Returns:
Font.

getFont

public java.awt.Font getFont(byte charset,
                             int size)
Gets a plain "other" font.

Parameters:
charset - Character set.
size - Size.
Returns:
Font.

getFont

public java.awt.Font getFont(int size)
Gets a plain Roman "other" font.

Parameters:
size - Size.

getMonospacedFont

public java.awt.Font getMonospacedFont(int style,
                                       int size)
Gets a monospaced font.

Parameters:
style - Style.
size - Size.
Returns:
Font.

getMonospacedFont

public java.awt.Font getMonospacedFont(int size)
Gets a plain monospaced font.

Parameters:
size - Size.
Returns:
Font.

initText

public void initText(Text text)
Initializes font information for text.

The font information is set for all the runs and widths are set for all the lines in the text.

Parameters:
text - Text.

getNominalLineHeight

public int getNominalLineHeight(byte charset)
Gets the nominal line height.

Parameters:
charset - Character set.
Returns:
Nominal line height in pixels (the height of a line in the nominal font size).