Difference between revisions of "Legacy:Font"

From Spherical
Jump to: navigation, search
m (Fix typo)
Line 1: Line 1:
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  
+
Sphere has its own font file format. These are files contain bitmap images and have the .rfn extension. You can use the Font object in Sphere to  
  
  

Revision as of 12:02, 23 June 2013

Sphere has its own font file format. These are files contain 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'