Functions

Font:ascii_chars() The a bitmap of the font's ASCII characters
Font:char(char) Get metrics of a particular character
Font:render(text, vertex, texcoord) Render text geometry
Font.size GET Get the size of the font
Font:width(text) Get the width of text in the font

Functions

Font:ascii_chars()

The a bitmap of the font's ASCII characters in a 16x16 grid

Return:

  • The bitmap as an Array
Font:char(char)

Get metrics of a particular character

Parameters:

char The character

Return:

  • The character metrics
Font:render(text, vertex, texcoord)

Render text into geometry for drawing a string of text using the bitmap returned by ascii_chars. Render expects the vertex and texcoord buffers to be at least as big as the text length * 4 since each character is rendered by a quad.

Example usage:

     local tex:fromarray(font:ascii_chars())
  
     local text = "jabberwocky"
     font:render(text, vertex, texcoord)
     mesh:vertex(vertex)
     mesh:texcoord(texcoord)
     
     tex:bind()
     mesh:draw()
     tex:unbind()
 

Parameters:

text The text
vertex The buffer to hold the vertex data
texcoord The buffer to hold the texcoord data
Font.size GET

Get the size of the font

Font:width(text)

Get the width of text in the font

Parameters:

text The text

Return:

  • The width of the text