FontImage

FontImage

# new FontImage(imageopt, tileSizeopt, paddingSizeopt, startTileIndexopt, contextopt)

Create an image font
Parameters:
Name Type Attributes Default Description
image Image <optional>
The image the font is stored in, if undefined the default font is used
tileSize Vector2 <optional>
vec2(8) The size of the font source tiles
paddingSize Vector2 <optional>
vec2(0,1) How much extra space to add between characters
startTileIndex Number <optional>
0 Tile index in image where font starts
context CanvasRenderingContext2D <optional>
overlayContext context to draw to

Methods

# drawText(text, pos, scaleopt, centeropt)

Draw text in world space using the image font
Parameters:
Name Type Attributes Default Description
text String
pos Vector2
scale Number <optional>
.25
center Boolean <optional>

# drawTextScreen(text, pos, scaleopt, centeropt)

Draw text in screen space using the image font
Parameters:
Name Type Attributes Default Description
text String
pos Vector2
scale Number <optional>
4
center Boolean <optional>