GL Studio C++ Runtime API
GlsFontBase Class Reference

#include <gls_font_base.h>

Inheritance diagram for GlsFontBase:
GlsArialRegular12 GlsRobotoRegular12 GlsRuntimeFontBase GlsUnicodeFontBase

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 Member Functions

 GlsFontBase (const FontAttr_t &fontAttr, const AttrCont_t &charAttributes, Image *texture)
 
const FontAttr_tAttributes () const
 
const CharAttr_tCharAttr (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
 
ImageTexture () 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
 

Detailed Description

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.

See also
GlsFontRenderer

Constructor & Destructor Documentation

GlsFontBase ( const FontAttr_t fontAttr,
const AttrCont_t &  charAttributes,
Image texture 
)

Class Constructor.

~GlsFontBase ( )
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.

Member Function Documentation

const FontAttr_t& Attributes ( ) const
inline

Access the attributes of the font.

Returns
all the attributes of the font.
const CharAttr_t& CharAttr ( Char_t  c) const
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.

Parameters
cThe character to retrieve attributes for.
Returns
The attributes for the character.
const AttrCont_t& CharAttributes ( ) const
inline

Access the character attributes of the font.

Returns
the attributes of all the characters in the font.
GLuint CharAttrIndex ( Char_t  c) const
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.

Parameters
cspecifies for which character the index is calculated for
Returns
the index of the specified character
std::string Family ( ) const
inline
Returns
The font family string
std::string Key ( ) const
inline
Returns
The unique lookup key for this font.
static std::string Key ( const std::string &  name,
const std::string &  style,
GLuint  ptSize 
)
static

Builds a unique lookup key for a specific font, style, and size.

Parameters
nameName of the font
styleStyle of the font
ptSizePoint size of the font
GLfloat MaxCharHeight ( ) const
inline
Returns
maximum height in pixels of the characters in the set
GLfloat MaxCharWidth ( ) const
inline
Returns
maximum width in pixels of the characters in the set
GLuint PtSize ( ) const
inline
Returns
maximum height in pixels of the characters in the set
std::string Style ( ) const
inline

Return the style description

Image* Texture ( ) const
inline
Returns
a pointer to the font's texture image.

Member Data Documentation

FontAttr_t _attr
protected

Attributes of the font.

AttrCont_t _charAttr
protected

Proportional character attributes used when proportional character spacing is turned on.

std::string _key
protected

Unique key used as a lookup key to find fonts within maps.

Image* _texture
protected

Texture of all characters in the set.


The documentation for this class was generated from the following file: