public class FontCache
extends java.lang.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 |
|---|---|
protected java.util.Map<java.lang.String,org.graphstream.ui.swing_viewer.util.FontSlot> |
cache
Cached fonts.
|
protected java.awt.Font |
defaultFont
The default font.
|
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.
|
java.awt.Font |
getDefaultFont()
The default font.
|
java.awt.Font |
getDefaultFont(org.graphstream.ui.graphicGraph.stylesheet.StyleConstants.TextStyle style,
int size) |
java.awt.Font |
getFont(java.lang.String name,
org.graphstream.ui.graphicGraph.stylesheet.StyleConstants.TextStyle style,
int size)
Lookup a font, and if not found, try to load it, if still not available,
return the default font.
|
protected final java.awt.Font defaultFont
protected final java.util.Map<java.lang.String,org.graphstream.ui.swing_viewer.util.FontSlot> cache
public static FontCache defaultFontCache
public java.awt.Font getDefaultFont()
public static FontCache defaultFontCache()
public java.awt.Font getDefaultFont(org.graphstream.ui.graphicGraph.stylesheet.StyleConstants.TextStyle style,
int size)
public java.awt.Font getFont(java.lang.String name,
org.graphstream.ui.graphicGraph.stylesheet.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.