Class

Font

Font(filename)

Constructor

# new Font(filename)

Load a '.FNT' file for GRX.
Parameters:
Name Type Description
filename * name of the font file.

View Source doc/classes.js, line 170

Members

# static filename

Name of the FNT file.

View Source doc/classes.js, line 174

# static height

Font height

View Source doc/classes.js, line 178

Methods

# DrawStringCenter(x, y, text, foreground, background)

Draw a center aligned string to the canvas.
Parameters:
Name Type Description
x number x position
y number y position.
text string the string to draw.
foreground Color foreground color.
background Color background color.

View Source doc/classes.js, line 196

# DrawStringLeft(x, y, text, foreground, background)

Draw a left aligned string to the canvas.
Parameters:
Name Type Description
x number x position
y number y position.
text string the string to draw.
foreground Color foreground color.
background Color background color.

View Source doc/classes.js, line 187

# DrawStringRight(x, y, text, foreground, background)

Draw a right aligned string to the canvas.
Parameters:
Name Type Description
x number x position
y number y position.
text string the string to draw.
foreground Color foreground color.
background Color background color.

View Source doc/classes.js, line 205

# StringHeight(text) → {number}

Calculate string height for this font.
Parameters:
Name Type Description
text string the string to check.

View Source doc/classes.js, line 217

the height in pixels.
number

# StringWidth(text) → {number}

Calculate string width for this font.
Parameters:
Name Type Description
text string the string to check.

View Source doc/classes.js, line 211

the width in pixels.
number