Drag[en]gine Script Module DragonScript Script API  1.0
Font Class Reference

Immutable font resources. More...

Inheritance diagram for Font:

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...
 
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...
 
static void loadAsynchron (String filename, ResourceNotifier notifier)
 Load font from file asynchronously. More...
 

Detailed Description

Immutable font resources.

This is a native class. It can not be subclassed.

Author
Roland Pl├╝ss
Version
1.0
Date
2015

Member Function Documentation

§ equals()

bool equals ( Object  other)

Font is equal to another object.

Implements Object.equals(Object).

Returns
true if other is of type Font and both point to the same engine font resource.

§ getCharAdvance()

float getCharAdvance ( int  char)

Advance of character in pixels using this font.

§ getCharBearing()

float getCharBearing ( int  char)

Bearing of character in pixels using this font.

§ getCharWidth()

float getCharWidth ( int  char)

Width of character in pixels using this font.

§ getFilename()

String getFilename ( )

Normalized filename the font has been loaded from.

§ getMaxWidth()

float getMaxWidth ( )

Largest width in pixels of all characters supported by this font.

§ getSize()

int getSize ( )

Font size in pixels.

This is also the line height of the font.

§ getTextSize()

Point getTextSize ( String  text)

Size of text in pixels using this font.

§ hashCode()

int hashCode ( )

Hash code for use as dictionary keys.

Implements Object.hashCode().

§ loadAsynchron()

static void loadAsynchron ( String  filename,
ResourceNotifier  notifier 
)
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 notifier is used to deliver the loaded font or null if the loading failed.

§ new()

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.


The documentation for this class was generated from the following file: