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
Use these on an initialized instance of the Font object.
- Font.clone(): returns a copy of 'font_object'
- 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.getHeight(): Get the height of chars in the font, in pixels.
- Font.getStringWidth(string): Determine the width of a string drawn with the font, in pixels.
- Font.getStringHeight(string, width): Determine the height of the string as if it was drawn by Font.drawTextBox() with width.
Font color masking
- Font.getColorMask(): Get the color mask being used by the font.
- Font.setColorMask(color): Set the color mask for a font to color (see color masking).
- Font.getCharacterImage(code): returns the image in the font_object of the character based on the code, e.g. 65 is 'A'
- Font.setCharacterImage(code, image): sets the character image in the font_object based on the code
Saving to disk
- Font.save(filename): saves the Font_object as a font using the filename 'filename'