Class FontTexture
In: lib/extras/font/font.rb
Parent: Object

A mono-spaced font texture that can be used to render strings.

Methods

draw   draw_centered   getHeight   getWidth   new  

Public Class methods

The constructor expects to find a fontname.png and a fontname.font

  • Each character should be wrapped in its own single pixel black border. (1 between the edge and 2 between characters)
  • The fontname.font should follow this pattern by line.
    1. Number of rows in the file.
    2. Number of columns in the file.
    3. Horizontal spacing for the font.
    4. Vertical spacing.
    5. Write ‘TRUE’ if there are capital and lower case letters in this font. Leave blank otherwise.
    6. Format string. List the characters in the font from left to right, bottom to top. Use spaces for empty characters.

Public Instance methods

Render a string. (x,y) is the position of the bottom-left corner, ande s is the scale.Fractional widths can be used for sub-pixel placement, but use with caution.

Get the position to render a string centered at (x,y). May return fractional widths. WARNING str cannot contain newline characters.

Gets the vertical spacing of the font.

Gets the horizontal spacing of the font.

[Validate]