GetSystemFont
From Spheriki
Retrieves the Sphere engine's default font.
Contents |
[edit]
Usage
Font GetSystemFont();
[edit]
Examples
var sfnt = GetSystemFont();
sfnt.drawText("Hi everybody!");
FlipScreen();
GetKey();
The above first loads the system default font, before using it to show the text "Hi everybody!" Sphere then waits for a key press.
GetSystemFont().drawText(0, 0, "Hello World");
This example shows it is possible to use the loaded font reference anonymously. However, if the system default font is used even more than once, then it is universally more efficient to call this function once and use the returned font object multiple times. See the Notes as to why this is so.
[edit]
Notes
- This function returns a Sphere Font object, which holds a special resource known as the system font. This system font is guaranteed to exist in all standard Sphere installations. The appearance of the font may vary between different versions of Sphere, however.
- GetSystemFont() is similar in operation to LoadFont(). This means it has to access the system font file in operation. The second example given in this document is not recommended because the high latency of disk access will place severe strain on both processing speed and memory usage.
- The font loaded by this function is the same font used by Sphere to display error messages in the display window/screen.
[edit]
See also
- FlipScreen()
- Font.drawText()
- GetKey()

