public class FontCache extends Object
This cache allows to avoid reloading fonts and allows to quickly lookup a font based on its name, its style (bold, italic) and its size.
Modifier and Type | Field and Description |
---|---|
static FontCache |
defaultFontCache
The default font cache.
|
Constructor and Description |
---|
FontCache()
New empty font cache.
|
Modifier and Type | Method and Description |
---|---|
static FontCache |
defaultFontCache()
Default singleton instance for shared font cache.
|
Font |
getDefaultFont()
The default font.
|
Font |
getDefaultFont(StyleConstants.TextStyle style,
int size) |
Font |
getFont(String name,
StyleConstants.TextStyle style,
int size)
Lookup a font, and if not found, try to load it, if still not available,
return the default font.
|
public static FontCache defaultFontCache
public Font getDefaultFont()
public static FontCache defaultFontCache()
public Font getDefaultFont(StyleConstants.TextStyle style, int size)
public Font getFont(String name, StyleConstants.TextStyle style, int size)
name
- The font name.style
- A style, taken from the styles available in the style sheets.size
- The font size in points.Copyright © 2015. All rights reserved.