Drag[en]gine Script Module DragonScript
1.23
|
Immutable font resources. More...
Public Member Functions | |
Management | |
String | getFilename () |
Normalized filename the font has been loaded from. More... | |
Point | getTextSize (String text) |
Size of text in pixels using this font. More... | |
float | getCharWidth (int char) |
Width of character in pixels using this font. More... | |
float | getCharAdvance (int char) |
Advance of character in pixels using this font. More... | |
float | getCharBearing (int char) |
Bearing of character in pixels using this font. More... | |
bool | hasGlyph (int character) |
Font has glyph. More... | |
int | getSize () |
Font size in pixels. More... | |
float | getMaxWidth () |
Largest width in pixels of all characters supported by this font. More... | |
bool | equals (Object other) |
Font is equal to another object. More... | |
int | hashCode () |
Hash code for use as dictionary keys. More... | |
Constructors | |
Font | new (String filename, int fontSize) |
Load font from file. More... | |
Font | new (Font font, int fontSize) |
Use font with different size. More... | |
static void | loadAsynchron (String filename, ResourceListener listener) |
Load font from file asynchronously. More... | |
Immutable font resources.
This is a native class. It can not be subclassed.
bool Dragengine.Gui.Font.equals | ( | Object | other | ) |
float Dragengine.Gui.Font.getCharAdvance | ( | int char | ) |
Advance of character in pixels using this font.
float Dragengine.Gui.Font.getCharBearing | ( | int char | ) |
Bearing of character in pixels using this font.
float Dragengine.Gui.Font.getCharWidth | ( | int char | ) |
Width of character in pixels using this font.
String Dragengine.Gui.Font.getFilename | ( | ) |
Normalized filename the font has been loaded from.
float Dragengine.Gui.Font.getMaxWidth | ( | ) |
Largest width in pixels of all characters supported by this font.
int Dragengine.Gui.Font.getSize | ( | ) |
Font size in pixels.
This is also the line height of the font.
Point Dragengine.Gui.Font.getTextSize | ( | String | text | ) |
Size of text in pixels using this font.
bool Dragengine.Gui.Font.hasGlyph | ( | int | character | ) |
Font has glyph.
int Dragengine.Gui.Font.hashCode | ( | ) |
Hash code for use as dictionary keys.
Implements Object.hashCode().
|
static |
Load font from file asynchronously.
Registers a request in the game engine to load an font. Once finished or if the file is already loaded the listener is used to deliver the loaded font or null if the loading failed.
Font Dragengine.Gui.Font.new | ( | String | filename, |
int | fontSize | ||
) |
Load font from file.
If the font file has been already loaded it is assigned to this object. If the font is not loaded yet the engine loads the font. This call blocks until the font is fully loaded and ready to be used. For asynchronous loading use loadAsynchron(). Multiple objects can point to the same loaded font resource. Once no object instance uses an font file anymore it is released from memory.