Difference between revisions of "Legacy:Functions/Fonts"
From Spherical
(created) |
(No difference)
|
Revision as of 17:32, 22 May 2013
Contents
Fonts
- Sphere Font object: The graphical representation of text.
- GetSystemFont(): Load the default system font.
- LoadFont(): Load a font file.
Font object
- Font.clone(): returns a copy of '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.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 characters
- 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'