GL Studio C++ Runtime API
|
#include <gls_font_base.h>
Classes | |
struct | CharAttr_t |
Character attributes. One item for each character in the set. More... | |
struct | FontAttr_t |
Attributes of the specific font. More... | |
Public Types | |
typedef GLuint | Char_t |
Define the character type to use. | |
typedef std::vector< CharAttr_t > | AttrCont_t |
Typedef for a list of character attributes. | |
Public Member Functions | |
GlsFontBase (const FontAttr_t &fontAttr, const AttrCont_t &charAttributes, Image *texture) | |
const FontAttr_t & | Attributes () const |
const CharAttr_t & | CharAttr (Char_t c) const |
GLuint | CharAttrIndex (Char_t c) const |
const AttrCont_t & | CharAttributes () const |
std::string | Family () const |
std::string | Key () const |
GLfloat | MaxCharHeight () const |
GLfloat | MaxCharWidth () const |
GLuint | PtSize () const |
std::string | Style () const |
Image * | Texture () const |
Static Public Member Functions | |
static std::string | Key (const std::string &name, const std::string &style, GLuint ptSize) |
Protected Member Functions | |
~GlsFontBase () | |
Protected Attributes | |
FontAttr_t | _attr |
AttrCont_t | _charAttr |
std::string | _key |
Image * | _texture |
Friends | |
class | GlsFontMan |
The GlsFontBase class provides a specific font face for use within the GL Studio. The font face is determined at construction time by the parameters passed in by the creator of the GlsFontBase instance. Specific instances should be wrapped in a singelton object wrapper, as there is no reason to have more than one instance of the exact same face (meaning font family, style, and point size.)
Once instanced, a GlsFontRenderer object can be used to render characters in Open GL at specific locations and with several different text effects.
GlsFontBase | ( | const FontAttr_t & | fontAttr, |
const AttrCont_t & | charAttributes, | ||
Image * | texture | ||
) |
Class Constructor.
fontAttr | Font attributes for this font. |
charAttributes | Attributes for each glyph of this font. |
texture | The generated texture atlas associated with this font. |
|
protected |
Class Destructor. This is protected so that no one can delete a font except via the font manager GlsFontMan. It is not vitual because we want to avoid calling destructors on unloaded font code, and it is not needed.
|
inline |
Access the attributes of the font.
|
inline |
NOTE: This function will only return char attributes for pre-generated ASCII fonts. Users should call CharAttrUnicode for GlsUnicodeFontBase fonts or CharAttrRuntime for GlsRuntimeFontBase fonts.
c | The character to retrieve attributes for. |
|
inline |
Access the character attributes of the font.
|
inline |
Calculates an index for the specified character depending on the set of characters the texture map was generated for. NOTE: This function will only return char attributes for pre-generated ASCII fonts. Users should call CharAttrUnicode for GlsUnicodeFontBase fonts or CharAttrRuntime for GlsRuntimeFontBase fonts.
c | specifies for which character the index is calculated for |
|
inline |
|
inline |
|
static |
Builds a unique lookup key for a specific font, style, and size.
name | Name of the font. |
style | Style of the font. |
ptSize | Point size of the font. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
Attributes of the font.
|
protected |
Proportional character attributes used when proportional character spacing is turned on.
|
protected |
Unique key used as a lookup key to find fonts within maps.
|
protected |
Texture of all characters in the set.