|
Drag[en]gine Script Module DragonScript 1.35
|
Immutable font resources. More...
Public Member Functions | |
Management | |
| String | getFilename () |
| Normalized filename the font has been loaded from. | |
| Point | getTextSize (String text) |
| Size of text in pixels using this font. | |
| Point | getTextSize (String text, float dilation) |
| Size of text in pixels using this font. | |
| float | getCharWidth (int char) |
| Width of character in pixels using this font. | |
| float | getCharAdvance (int char) |
| Advance of character in pixels using this font. | |
| float | getCharBearing (int char) |
| Bearing of character in pixels using this font. | |
| bool | hasGlyph (int character) |
| Font has glyph. | |
| int | getSize () |
| Font size in pixels. | |
| float | getMaxWidth () |
| Largest width in pixels of all characters supported by this font. | |
| float | getBaseLine () |
| Base line in pixels from top. | |
| float | getAvgCharWidth () |
| Average character width in pixels using this font. | |
| bool | equals (Object other) |
| Font is equal to another object. | |
| int | hashCode () |
| Hash code for use as dictionary keys. | |
Constructors | |
| Font | new (String filename, int fontSize) |
| Load font from file. | |
| Font | new (Font font, int fontSize) |
| Use font with different size. | |
| static void | loadAsynchron (String filename, ResourceListener listener) |
| Load font from file asynchronously. | |
Immutable font resources.
This is a native class. It can not be subclassed.
| bool Dragengine.Gui.Font.equals | ( | Object | other | ) |
Font is equal to another object.
Implements Object.equals(Object).
References getBaseLine().
Referenced by hashCode().
| float Dragengine.Gui.Font.getAvgCharWidth | ( | ) |
Average character width in pixels using this font.
References getMaxWidth(), and getSize().
Referenced by hashCode().
| float Dragengine.Gui.Font.getBaseLine | ( | ) |
| float Dragengine.Gui.Font.getCharAdvance | ( | int char | ) |
| float Dragengine.Gui.Font.getCharBearing | ( | int char | ) |
| float Dragengine.Gui.Font.getCharWidth | ( | int char | ) |
Width of character in pixels using this font.
Referenced by getCharBearing().
| String Dragengine.Gui.Font.getFilename | ( | ) |
Normalized filename the font has been loaded from.
Referenced by getTextSize().
| float Dragengine.Gui.Font.getMaxWidth | ( | ) |
Largest width in pixels of all characters supported by this font.
References hasGlyph().
Referenced by getAvgCharWidth().
| int Dragengine.Gui.Font.getSize | ( | ) |
Font size in pixels.
This is also the line height of the font.
References getCharBearing().
Referenced by getAvgCharWidth().
| Point Dragengine.Gui.Font.getTextSize | ( | String | text | ) |
Size of text in pixels using this font.
References getFilename(), and getTextSize().
Referenced by getCharAdvance(), and getTextSize().
| Point Dragengine.Gui.Font.getTextSize | ( | String | text, |
| float | dilation ) |
Size of text in pixels using this font.
Same as getTextSize(String) but includes dilation as percentage of the font size. Dilation can be all kinds of dilations like explicit dilation, text borders or similar effects that result in enlarging a font.
| bool Dragengine.Gui.Font.hasGlyph | ( | int | character | ) |
| int Dragengine.Gui.Font.hashCode | ( | ) |
Hash code for use as dictionary keys.
Implements Object.hashCode().
References equals(), getAvgCharWidth(), and hashCode().
Referenced by 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.
References loadAsynchron().
Referenced by loadAsynchron().
Use font with different size.
References new().
| 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.
References new().