Legacy:Font

From Spherical
Revision as of 12:01, 23 June 2013 by DaVince (talk | contribs)
Jump to: navigation, search

Sphere has its own font file format. These are files containing bitmap images and have the .rfn extension. You can use the Font object in Sphere to


Initializing a font object

Function methods

Use these on an initialized instance of the Font object.

Font object

Drawing text

  • Font.drawText(x, y, text): Draw text at (x, y) using the font.
  • Font.drawTextBox(x, y, width, height, y_offset, text): Draw wrapped text, shifted up/down by y_offset, in the box (x, y, width, height).
  • Font.drawZoomedText(x, y, scale, text): Draw scaled text with upper-left corner (x, y) using the font.
  • Font.wordWrapString(string, width): Splits a string into an array of lines as if it were wrapped using Font.drawTextBox().

Font size info

Font color masking

Font characters

Saving to disk

  • Font.save(filename): saves the Font_object as a font using the filename 'filename'