Class: CanvasFont

pc.CanvasFont

Represents the resource of a canvas font asset.

Constructor

(private) new CanvasFont(app, options)

Parameters:
Name Type Description
app pc.Application The application
options Object The font options
Properties
Name Type Attributes Description
fontName String <optional>
The name of the font, use in the same manner as a CSS font
fontWeight String <optional>
The weight of the font, e.g. 'normal', 'bold', defaults to "normal"
fontSize Number <optional>
The size the font will be rendered into to the texture atlas at, defaults to 32
color pc.Color <optional>
The color the font will be rendered into the texture atlas as, defaults to white
width Number <optional>
The width of each texture atlas, defaults to 512
height Number <optional>
The height of each texture atlas, defaults to 512
padding Number <optional>
Amount of glyph padding added to each glyph in the atlas
Source:

Methods

(private) createTextures(text)

Render the necessary textures for all characters in a string to be used for the canvas font
Parameters:
Name Type Description
text String The list of characters to render into the texture atlas
Source:

(private) destroy()

Tears down all resources used by the font
Source:

(private) updateTextures(text)

Update the list of characters to include in the atlas to include those provided and re-render the texture atlas to include all the characters that have been supplied so far.
Parameters:
Name Type Description
text String The list of characters to add to the texture atlas
Source: