Logics for loading font into the resource_map,
note that "font" consists of two files: the bitmap font image and the associated xml descriptor file
Found in Chapter 5, page 245 of the textbook
Example: 5.4 Font Support- Source:
Classes
Methods
(static) descName(fontName) → {string}
Returns the path of the font description file with ".fnt" appened
Parameters:
| Name | Type | Description |
|---|---|---|
fontName |
string | the path to the font files |
- Source:
Returns:
path to font description file
- Type
- string
(static) getCharInfo(fontName, aChar) → {CharacterInfo}
Returns a CharacterInfo object with the size and texel information for the character texture
Parameters:
| Name | Type | Description |
|---|---|---|
fontName |
string | path to the font image and description files |
aChar |
string | the single character (code) to get information for |
- Source:
Returns:
a new instance of CharacterInfo, null if unsuccessful
- Type
- CharacterInfo
(static) has(fontName) → {boolean}
Returns whether the font is already in the resource map
Parameters:
| Name | Type | Description |
|---|---|---|
fontName |
string | path to the font image and description files |
- Source:
Returns:
true if the font image and font description are loaded
- Type
- boolean
(static) imageName(fontName) → {string}
Returns the fontName with ".png" appened
Parameters:
| Name | Type | Description |
|---|---|---|
fontName |
string | the path to the font files |
- Source:
Returns:
fontName with file extension
- Type
- string
(static) load(fontName)
Load the font image as a texture and the font description as an XMLDocument
Parameters:
| Name | Type | Description |
|---|---|---|
fontName |
string | path to the font image and description files |
- Source:
(static) unload(fontName)
Unload the font to allow for garbage collection
Parameters:
| Name | Type | Description |
|---|---|---|
fontName |
string | path to the font image and description files |
- Source: