JIDE 3.5.15

com.jidesoft.swing
Class FontUtils

java.lang.Object
  extended by com.jidesoft.swing.FontUtils

public class FontUtils
extends Object

This is a global class to keep a record of Font so that we can improve the performance and memory usage in various scenarios like StyledLabel.

In this class, we have a global map of font and derived font. It probably could be huge after running a long time. In that case, you need explicitly clear the font cache in this class by using clearDerivedFontCache() .


Constructor Summary
FontUtils()
           
 
Method Summary
static void clearDerivedFontCache()
          Clear cache whenever needed.
static Font getCachedDerivedFont(Font font, int style, int size)
          Get derived font by font, style and size.
static int getDerivedFontCacheSize()
          Gets the derived font cache size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontUtils

public FontUtils()
Method Detail

getDerivedFontCacheSize

public static int getDerivedFontCacheSize()
Gets the derived font cache size.

Returns:
the derived font cache size.

clearDerivedFontCache

public static void clearDerivedFontCache()
Clear cache whenever needed.


getCachedDerivedFont

public static Font getCachedDerivedFont(Font font,
                                        int style,
                                        int size)
Get derived font by font, style and size. At first it will get the derived font from cache. If it cannot hit the derived font, it will invoke font.deriveFont to derive a font.

Parameters:
font - the original font
style - the font style
size - the font size
Returns:
the derived font.

JIDE 3.5.15