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 FontDetails<?> |
explicitFont
Explicit 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 CentralLogger |
LOG
Logger
|
private Widget<?> |
widget
The widget that associated with this font resolver
|
private Window<?> |
window
Window instance.
|
| Constructor and Description |
|---|
GuiFontResolver(Window<?> window,
GuiDriver<?,?> gd,
BaseConfig config,
boolean fixedFont,
FontDetails<?> explicitFont)
Constructor that creates temporary instances that are not managed by FontManager.
|
GuiFontResolver(Window<?> window,
GuiDriver<?,?> gd,
Widget<?> widget,
BaseConfig config)
Constructor.
|
GuiFontResolver(Window<?> window,
GuiDriver<?,?> gd,
Widget<?> widget,
BaseConfig config,
boolean fixedFont)
Constructor.
|
GuiFontResolver(Window<?> window,
GuiDriver<?,?> gd,
Widget<?> widget,
BaseConfig config,
boolean fixedFont,
FontDetails<?> explicitFont)
Constructor.
|
GuiFontResolver(Window<?> window,
GuiDriver<?,?> gd,
Widget<?> widget,
BaseConfig config,
boolean fixedFont,
FontDetails<?> explicitFont,
boolean registerWithFontManager)
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 |
setWindow(Window<?> window)
Set new window.
|
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 CentralLogger 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 Widget<?> widget
private GuiDriver<?,?> gd
private BaseConfig config
private FontDetails<?> explicitFont
private boolean fixedFont
private GuiFontResolver.FontCache explicitFontCache
private GuiFontResolver.FontCache customFontCache
public GuiFontResolver(Window<?> window, GuiDriver<?,?> gd, Widget<?> widget, BaseConfig config)
If the referenced BaseConfig.font is undefined, it defaults to the
FontManager.DEFAULT_FONT.
window - Window instance.gd - Screen driver.widget - The given widgetconfig - The given widget configurationpublic GuiFontResolver(Window<?> window, GuiDriver<?,?> gd, Widget<?> widget, BaseConfig config, boolean fixedFont)
window - Window instance.gd - Screen driver.widget - The given widgetconfig - The given widget configurationfixedFont - Flag identifying that the referenced font must default to the default fixed font,
if is not specified.public GuiFontResolver(Window<?> window, GuiDriver<?,?> gd, Widget<?> widget, BaseConfig config, boolean fixedFont, FontDetails<?> explicitFont)
window - Window instance.gd - Screen driver.widget - The given widgetconfig - The given widget configurationfixedFont - 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(Window<?> window, GuiDriver<?,?> gd, Widget<?> widget, BaseConfig config, boolean fixedFont, FontDetails<?> explicitFont, boolean registerWithFontManager)
window - Window instance.gd - Screen driver.widget - The given widgetconfig - The given widget configurationfixedFont - 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.registerWithFontManager - if true then the new resolver will be registered with FontManagerpublic GuiFontResolver(Window<?> window, GuiDriver<?,?> gd, BaseConfig config, boolean fixedFont, FontDetails<?> explicitFont)
window - Window instance.gd - Screen driver.config - The given widget configurationfixedFont - 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 void setWindow(Window<?> window)
window - Window instance.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()