Skip to content

class Font


methods


Font.ftInit


function Font.ftInit()

Initializes the TTF Fonts system

Font.ftLoad


function Font.ftLoad(path: string) -> fonthandle ttf

@param path - path to file

@return fonthandle - ttf font internal ID. see ttf

Loads a TTF font from a file

Font.ftSetPixelSize


function Font.ftSetPixelSize(
  font: ttf,
  width: integer,
  height: integer
)

@param font - font handle

Changes font pixel size

Font.ftSetCharSize


function Font.ftSetCharSize(
  font: ttf,
  width: integer,
  height: integer
)

@param font - font handle

Changes font char size

Font.ftPrint


function Font.ftPrint(
  font: ttf,
  x: integer,
  y: integer,
  fontalign: fontalign {
    ALIGN_TOP = 0,
    ALIGN_BOTTOM = 1,
    ALIGN_VCENTER = 2,
    ALIGN_LEFT = 0,
    ALIGN_RIGHT = 4,
    ALIGN_HCENTER = 8,
    ALIGN_NONE = integer,
    ALIGN_CENTER = integer,
},
  width: integer,
  height: integer,
  text: string,
  color: color
)

@param font - font handle

@param x - X coordinate

@param y - Y coordinate

@param fontalign - alignment tokens for text: [ALIGN_HCENTER, ALIGN_NONE, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_BOTTOM]

@param width - defines width of draw area, text that goes beyond this area is not drawn

@param height - defines height of draw area, text that goes beyond this area is not drawn

@param text - the text to be written

@param color - [Optional]: if not specified default is RGBA #80808080

Prints text with a font

@see Color.new

Font.ftUnload


function Font.ftUnload(font: ttf)

@param font - font handle

Unloads a font from RAM

Font.ftEnd


function Font.ftEnd()

DeInitializes the TTF Fonts system

Font.load


function Font.load(path: string) -> fonthandle gsfont

@param path - path to font

Loads a GSFONT from FNT, PNG or BMP files

Font.print


function Font.print(
  font: gsfont,
  x: number,
  y: number,
  scale: number,
  text: string,
  color: color
)

@param font - GSFONT handle

@param x - X coordinate

@param y - Y coordinate

@param scale - scale

@param text - text to print

@param color - [Optional]: if not specified default is RGBA #80808080

Prints text with a GSFONT

@see Font.load Color.new

Font.unload


function Font.unload(font: gsfont)

@param font - GSFONT handle

unloads a GSFONT

@see Font.load

Font.fmLoad


function Font.fmLoad()

Loads the OSD system font rom0:FONTM
WARNING: Some systems, like the PSX-DESR and all Arcade PS2s do not have this file as part of their bios, wich makes this function useless on such machines

Font.fmPrint


function Font.fmPrint(
  x: number,
  y: number,
  scale: number,
  text: string,
  color: color
)

@param x - X coordinate

@param y - Y coordinate

@param scale - scaling factor for text

@param text - text to print

@param color - [Optional]: if not specified default is RGBA #80808080

Prints text with the OSD Font. you must call Font.fmLoad before using

@see Color.new Font.fmLoad

Font.fmUnload


function Font.fmUnload()

unloads the OSD Font from RAM

@see Font.fmLoad