Class FontLoader
- java.lang.Object
-
- ch.sahits.game.graphic.image.impl.FontLoader
-
- All Implemented Interfaces:
IFontLoader
@Service public class FontLoader extends java.lang.Object implements IFontLoader
Font loader for loading fonts. This is implemented as a singleton- Author:
- Andi Hotz, (c) Sahits GmbH, 2011 Created on Nov 13, 2011
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
default_font_family
private java.util.HashMap<java.lang.String,javafx.scene.text.Font>
fontCash
Cash for already loaded fonts
-
Constructor Summary
Constructors Constructor Description FontLoader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.scene.text.Font
createDefaultFont(int size)
Create the serif default font for JavaFX in a specific size.private javafx.scene.text.Font
getFontJavaFX(java.lang.String fontName, int size)
Retrieve the font with a font family.(package private) void
initializeJFXFonts()
Initialize the custom fonts so they can be used from JavaFX.static javafx.scene.text.Font
loadTestFont()
Load a font of size 12 for test purposes.
-
-
-
Method Detail
-
initializeJFXFonts
void initializeJFXFonts()
Initialize the custom fonts so they can be used from JavaFX. This method must be called before first usage in CSS.
-
loadTestFont
public static javafx.scene.text.Font loadTestFont()
Load a font of size 12 for test purposes.- Returns:
- Test font
-
createDefaultFont
public javafx.scene.text.Font createDefaultFont(int size)
Description copied from interface:IFontLoader
Create the serif default font for JavaFX in a specific size. (OpenPatrician)- Specified by:
createDefaultFont
in interfaceIFontLoader
- Parameters:
size
- font size- Returns:
- JavaFX font
-
getFontJavaFX
private javafx.scene.text.Font getFontJavaFX(java.lang.String fontName, int size)
Retrieve the font with a font family.- Parameters:
fontName
- Family name of the fontsize
- of the font in pt- Returns:
- JavaFX font
-
-