Font class
From Solid Graphics Wiki
| ||||||||||||
The Font class provides capability to type texture-based text into an OpenGL window. The font object must be loaded using an 2D raster image which specifies 16 x 16 grid of ASCII characters. Each position in the grid corresponds to one ASCII character code. The first (top) row's and first (left) grid column correspondes to ASCII code 0, second grid row starts with ASCII code 16, and so on.
Note that even if the text can be printed in any size, it usually looks best when 1 pixel from the source texture is mapped onto one pixel on the OpenGL based window.
Constructors
The only Font class constructors is constructor without any parameters.
Fields
| Field name | Type | Description |
| defaultSpaceWidth | float | Specifies width of the space character. The Font constructor initializes this field to value 0.25f |
Methods
| Method name | Description |
| Load | Loads the font from a file, memory, application-attached-resource or an image class object. |
| IsLoaded | Returns true if the font texture is successfully loaded and the font object is ready to be used for printing a text. Otherwise returns false. |
| Clear | Release all font object related resources (such as texture) from the memory or OPenGL rendering context. When this method finishes the font is considered "unloaded". |
| PrintText | Prints text into an OpenGL window using the font and specified text size. |
| SetCharWidths | Specifies character widths for the ASCII codes. |
| SetCharWidth | Specifies single ASCII code character width. |
| GetCharWidths | Returns font's definitions for the ASCII charactes widths into buffer of 256 float values. |
| GetCharWidth | Returns font's definition of ASCII character code width. |
| TextWidth | Calculates text width. |
Operators
The class has no public operators defined.
See Also
SolidKit Library Documentation
