public class GuiFontResolver
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
GuiFontResolver.FontCache
Font cache item.
|
Modifier and Type | Field and Description |
---|---|
private BaseConfig |
config
Widget config.
|
private GuiFontResolver.FontCache |
customFontCache
Cached custom font.
|
private GuiFontResolver.FontCache |
explicitFontCache
Explicitly specified font which takes precedence over the font specified by the font number
in the widget config.
|
private boolean |
fixedFont
Flag identifying that the referenced font must default to the default fixed font, if is
not specified.
|
private java.util.Map<java.lang.Integer,GuiFontResolver.FontCache> |
fontCache
Widget font cache.
|
boolean |
fontChanged
true when there is a newly added font. |
private GuiDriver<?,?> |
gd
Screen driver.
|
static java.util.logging.Logger |
LOG
Logger
|
private Window<?> |
window
Window instance.
|
Constructor and Description |
---|
GuiFontResolver(Window<?> window,
GuiDriver<?,?> gd,
BaseConfig config)
Constructor.
|
GuiFontResolver(Window<?> window,
GuiDriver<?,?> gd,
BaseConfig config,
boolean fixedFont)
Constructor.
|
GuiFontResolver(Window<?> window,
GuiDriver<?,?> gd,
BaseConfig config,
boolean fixedFont,
FontDetails<?> explicitFont)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
GuiFontResolver.FontCache |
font()
Resolve font.
|
int |
resolveFontNum()
Resolve the font number, in case the configuration has an undefined font.
|
void |
updateFont()
Updates font resolver according to config.font.
|
private void |
updateFontCache()
Updates the current font.
|
boolean |
updateFontCache(int font,
FontDetails<?> newFont)
Clears the given font from this font cache in order to resolve it again as this font has
been changed, then it repaints the affected widget.
|
void |
updateFontSize()
Updates font resolver according to config.fontSize.
|
public static final java.util.logging.Logger LOG
public boolean fontChanged
true
when there is a newly added font.private java.util.Map<java.lang.Integer,GuiFontResolver.FontCache> fontCache
private Window<?> window
private GuiDriver<?,?> gd
private BaseConfig config
private boolean fixedFont
private GuiFontResolver.FontCache explicitFontCache
private GuiFontResolver.FontCache customFontCache
public GuiFontResolver(Window<?> window, GuiDriver<?,?> gd, BaseConfig config)
If the referenced BaseConfig.font
is undefined, it defaults to the
FontManager.DEFAULT_FONT
.
window
- Window instance.gd
- Screen driver.config
- Widget configuration.public GuiFontResolver(Window<?> window, GuiDriver<?,?> gd, BaseConfig config, boolean fixedFont)
window
- Window instance.gd
- Screen driver.config
- Widget configuration.fixedFont
- Flag identifying that the referenced font must default to the default fixed font,
if is not specified.public GuiFontResolver(Window<?> window, GuiDriver<?,?> gd, BaseConfig config, boolean fixedFont, FontDetails<?> explicitFont)
window
- Window instance.gd
- Screen driver.config
- Widget configuration.fixedFont
- Flag identifying that the referenced font must default to the default fixed font,
if is not specified.explicitFont
- Explicitly specified font which takes precedence over the font specified by the
font number in the widget config.public GuiFontResolver.FontCache font()
public int resolveFontNum()
configured
font is undefined, then either the
FontManager.DEFAULT_FONT
or FontManager.DEFAULT_FIXED_FONT
is
returned, depending on the fixedFont
flag.public boolean updateFontCache(int font, FontDetails<?> newFont)
font
- The given font numbernewFont
- The new font descriptionpublic void updateFont()
public void updateFontSize()
private void updateFontCache()