Package com.jidesoft.swing
Class FontUtils
java.lang.Object
com.jidesoft.swing.FontUtils
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Clear cache whenever needed.static Font
getCachedDerivedFont
(Font font, int style, int size) Get derived font by font, style and size.static int
Gets the derived font cache size.
-
Constructor Details
-
FontUtils
public FontUtils()
-
-
Method Details
-
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
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 fontstyle
- the font stylesize
- the font size- Returns:
- the derived font.
-