Shaku

Shaku JS

Back To Table of Content

Msdf Font Texture Asset

MsdfFontTextureAsset

A MSDF font texture asset, from a pregenerated msdf texture atlas (from msdf-bmfont-xml, for example). This asset uses a signed distance field atlas to render characters as sprites at high res.

Kind: global class

msdfFontTextureAsset.width ⇒ Number

Get texture width.

Kind: instance property of MsdfFontTextureAsset
Returns: Number - Texture width.

msdfFontTextureAsset.height ⇒ Number

Get texture height.

Kind: instance property of MsdfFontTextureAsset
Returns: Number - Texture height.

msdfFontTextureAsset.load(params) ⇒ Promise

Generate the font metadata and texture from the given URL.

Kind: instance method of MsdfFontTextureAsset
Returns: Promise - Promise to resolve when fully loaded.

Param Type Description
params \* Additional params. Possible values are: - jsonUrl: mandatory url for the font’s json metadata (generated via msdf-bmfont-xml, for example) - textureUrl: mandatory url for the font’s texture atlas (generated via msdf-bmfont-xml, for example) - missingCharPlaceholder (default=’?’): character to use for missing characters.

msdfFontTextureAsset.getSize() ⇒ Vector2

Get texture size as a vector.

Kind: instance method of MsdfFontTextureAsset
Returns: Vector2 - Texture size.

msdfFontTextureAsset.getPositionOffset()

Kind: instance method of MsdfFontTextureAsset

msdfFontTextureAsset.getXAdvance()

Kind: instance method of MsdfFontTextureAsset

msdfFontTextureAsset.destroy()

Kind: instance method of MsdfFontTextureAsset