A font texture asset, dynamically generated from loaded font and canvas. This asset type creates an atlas of all the font's characters as textures, so we can later render them as sprites.
Measure font's actual height.
Measure font's actual width.
A font texture asset, dynamically generated from loaded font and canvas. This asset type creates an atlas of all the font’s characters as textures, so we can later render them as sprites.
Kind: global class
Number
Number
Promise
Vector2
Rectangle
Vector2
Number
Get line height.
Kind: instance property of FontTextureAsset
Get font name.
Kind: instance property of FontTextureAsset
Get font size.
Kind: instance property of FontTextureAsset
Get placeholder character.
Kind: instance property of FontTextureAsset
Get the texture.
Kind: instance property of FontTextureAsset
Number
Get texture width.
Kind: instance property of FontTextureAsset
Returns: Number
- Texture width.
Number
Get texture height.
Kind: instance property of FontTextureAsset
Returns: Number
- Texture height.
Kind: instance property of FontTextureAsset
Promise
Generate the font texture from a font found in given URL.
Kind: instance method of FontTextureAsset
Returns: Promise
- Promise to resolve when fully loaded.
Param | Type | Description |
---|---|---|
params | \* |
Additional params. Possible values are: - fontName: mandatory font name. on some browsers if the font name does not match the font you actually load via the URL, it will not be loaded properly. - missingCharPlaceholder (default=’?’): character to use for missing characters. - smoothFont (default=true): if true, will set font to smooth mode. - fontSize (default=52): font size in texture. larget font size will take more memory, but allow for sharper text rendering in larger scales. - enforceTexturePowerOfTwo (default=true): if true, will force texture size to be power of two. - maxTextureWidth (default=1024): max texture width. - charactersSet (default=FontTextureAsset.defaultCharactersSet): which characters to set in the texture. - extraPadding (default=0,0): Optional extra padding to add around characters in texture. - sourceRectOffsetAdjustment (default=0,0): Optional extra offset in characters source rectangles. Use this for fonts that are too low / height and bleed into other characters source rectangles. |
Vector2
Get texture size as a vector.
Kind: instance method of FontTextureAsset
Returns: Vector2
- Texture size.
Rectangle
Get the source rectangle for a given character in texture.
Kind: instance method of FontTextureAsset
Returns: Rectangle
- Source rectangle for character.
Param | Type | Description |
---|---|---|
character | Character |
Character to get source rect for. |
Vector2
When drawing the character, get the offset to add to the cursor.
Kind: instance method of FontTextureAsset
Returns: Vector2
- Offset to add to the cursor before drawing the character.
Param | Type | Description |
---|---|---|
character | Character |
Character to get the offset for. |
Number
Get how much to advance the cursor when drawing this character.
Kind: instance method of FontTextureAsset
Returns: Number
- Distance to move the cursor after drawing the character.
Param | Type | Description |
---|---|---|
character | Character |
Character to get the advance for. |
Kind: instance method of FontTextureAsset
Measure font’s actual height.
Measure font’s actual width.
Kind: global function