ice.pilots.html4
Class FontCache

java.lang.Object
  extended byice.pilots.html4.FontCache

public class FontCache
extends Object

The FontCache class is intended to provided Font caching throughout the html4 pilot. Ideally, No class in the package will construct their own Font objects, but will use this class to obtain references to Font objects from this class, allowing sharing of Font resources.


Constructor Summary
FontCache()
           
 
Method Summary
 void clear()
          Clear the FontCache
 String getDefaultFontFamily()
          Retrieve the id of the default font family used in the system This value is the index into the array of Font family names found in the system in startup.
 Font getTestedFont(char[] text, int start, int limit, CSSAttribs css)
          Retrieve a font which has been tested and verified to display a given passage of text correctly.
 Font getTestedFont(String text, CSSAttribs css)
          This method performs the same logic as above, but for objects who already have access to Strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontCache

public FontCache()
Method Detail

getTestedFont

public Font getTestedFont(char[] text,
                          int start,
                          int limit,
                          CSSAttribs css)
Retrieve a font which has been tested and verified to display a given passage of text correctly. #3542. WARNING. As a side effect of this method call, if this method finds a font family that can render the characters properly, it will update the CSSAttribs object to 'remember' the new font_family. If the system contains no FontFamily that can display the text, the systemwide defaultFont (from defaultFontFamily) will be returned.

Parameters:
text - The chars to display
start - The starting character to test
limit - The number of characters to test
css - The CSSAttribs object defining the font characteristics
Returns:
A Font object that has been tested as able to display the Font.

getTestedFont

public Font getTestedFont(String text,
                          CSSAttribs css)
This method performs the same logic as above, but for objects who already have access to Strings. Currently, this would be the Swing widgets, but not the AWT widgets.

Parameters:
text - The chars to display
css - A CSSAttribs object containing hints of the first font to try
Returns:
A Font object that has been tested as able to display the Font.

getDefaultFontFamily

public String getDefaultFontFamily()
Retrieve the id of the default font family used in the system This value is the index into the array of Font family names found in the system in startup.

Returns:
The

clear

public void clear()
Clear the FontCache