Class: Font

Font()

Represents a font. Data is stored similarly to tilesets in an array, with the ability to remap characters that have a unicode point larger than the array can hold.

Constructor

new Font()

Source:

Members

charData

Object mapping unicode points to character information. Used for changing a characters size or remapping unicode points larger than what fits on the tile sheet.
Source:

data

Uint8ClampedArray of the tile sheet data. Generated by the constructor.
Source:

height

The number of rows in the tile sheet
Source:

letterSpacing

Number of pixels between each character
Source:

originX

The x origin in pixels of the character relative to the bottom left.
Source:

originY

The y origin in pixels of the character relative to the bottom left.
Source:

standardWidth

The standard width for a character. Used as the default if none is specified for a character.
Source:

tileSize

The tile size of the tile sheet where the characters are drawn
Source:

width

The number of columns in the tile sheet
Source:

Methods

baseIndexForChar(charCode)

Get the base index in the data array for the character
Parameters:
Name Type Description
charCode number the unicode point for the character
Source:

widthForChar(charCode)

Get the width of a character
Parameters:
Name Type Description
charCode number the unicode point for the character
Source: