FontManager Class Reference

#include <FontManager.h>

List of all members.

Public Member Functions

void registerFont (const string &fontname, const string &filename, const string &filenameBold)
 Registers a font for use in the Font Manager.
void bindStandard (const string &fontname)
 Binds the standard texture of a font in OpenGL.
void bindBold (const string &fontname)
 Binds the bold texture of a font in OpenGL.
TexturegetStandardTexture (const string &fontname)
 Returns the standard texture of a font.
TexturegetBoldTexture (const string &fontname)
 Returns the bold texture of a font.
struct fontCoordsgetStandardCoords (const string &fontname)
 Returns the coordinate sets of the standard styled texture of a font.
struct fontCoordsgetBoldCoords (const string &fontname)
 Returns the coordinate sets of the bold styled texture of a font.
virtual string toString () const
 Returns a textual representation.
virtual string className () const
 Returns the class name of the object.
virtual enum classId classId () const
 Returns the class id of the object.

Static Public Member Functions

static FontManagergetInstance ()
 The getter for the singleton instance.

Private Member Functions

 FontManager ()
 The constructor.
 FontManager (const FontManager &source)
 The copy constructor.
 ~FontManager ()
 The destructor.
ILubyte getPixelAlpha (const ILuint &x, const ILuint &y)
 Gets a pixel's alpha value from the active DevIL image (top left origin).
void getMinMax (const unsigned char &charId, Uint32 &min, Uint32 &max)
 Gets the left and right border of a character in the active DevIL image.
void generateFontCoords (Texture &texture, struct fontCoords *coords)
 Generates a font coordinates set from a texture.

Private Attributes

vector< fontEntryfonts
 The place to store all information about loaded textures.

Static Private Attributes

static FontManagerinstance = 0
 The singleton instance of this Manager.


Constructor & Destructor Documentation

FontManager::FontManager (  )  [private]

The constructor.

Initializes the font manager.

FontManager::FontManager ( const FontManager source  )  [private]

The copy constructor.

Should not be called.

FontManager::~FontManager (  )  [private]

The destructor.

Destroyes the texture manager and frees all memory occupied by textures. Should not be called.


Member Function Documentation

ILubyte FontManager::getPixelAlpha ( const ILuint &  x,
const ILuint &  y 
) [private]

Gets a pixel's alpha value from the active DevIL image (top left origin).

Returns the grayscale value of the active grayscale image at the coordinates x and y with the origin in the top left corner.

Parameters:
x The x coordinate
y The y coordinate
Returns:
The color of the selected pixel ranging 0..255

void FontManager::getMinMax ( const unsigned char &  charId,
Uint32 &  min,
Uint32 &  max 
) [private]

Gets the left and right border of a character in the active DevIL image.

calculates the coordinates of the right quad

Parameters:
charId The Id (0..255) of the Character whose position is wanted
charXmin The minimal x Coordinate of the character
charYmax The minimal y coordinate of the character

void FontManager::generateFontCoords ( Texture texture,
struct fontCoords coords 
) [private]

Generates a font coordinates set from a texture.

FontManager * FontManager::getInstance (  )  [static]

The getter for the singleton instance.

The only way to access the manager

void FontManager::registerFont ( const string &  fontname,
const string &  filename,
const string &  filenameBold 
)

Registers a font for use in the Font Manager.

Adds a font if not already present.

Parameters:
fontname The identifier for this font. Must be unique, otherwise this call has no effect.
filename The path to the standard styled texture of that font
filename The path to the bold styled texture of that font

void FontManager::bindStandard ( const string &  fontname  ) 

Binds the standard texture of a font in OpenGL.

Makes the font's standard texture the active texture to use in OpenGL.

Parameters:
filename Must be a fontname already registered otherwise the call will have no effect.

void FontManager::bindBold ( const string &  fontname  ) 

Binds the bold texture of a font in OpenGL.

Makes the font's standard texture the active texture to use in OpenGL.

Parameters:
filename Must be a fontname already registered otherwise the call will have no effect.

Texture * FontManager::getStandardTexture ( const string &  fontname  ) 

Returns the standard texture of a font.

Parameters:
fontname Must be a fontname already registered otherwise the call returns 0. This returns the standard styled font texture.
Returns:
The texture that is assigned to this font. 0 indicates an error.

Texture * FontManager::getBoldTexture ( const string &  fontname  ) 

Returns the bold texture of a font.

Parameters:
fontname Must be a fontname already registered otherwise the call returns 0. This returns the bold styled font texture.
Returns:
The texture that is assigned to this font. 0 indicates an error.

struct fontCoords * FontManager::getStandardCoords ( const string &  fontname  )  [read]

Returns the coordinate sets of the standard styled texture of a font.

struct fontCoords * FontManager::getBoldCoords ( const string &  fontname  )  [read]

Returns the coordinate sets of the bold styled texture of a font.

string FontManager::toString (  )  const [virtual]

Returns a textual representation.

Returns:
a string descriping the run-time object

string FontManager::className (  )  const [virtual]

Returns the class name of the object.

Returns:
a string with the name of the object's class

enum classId FontManager::classId (  )  const [virtual]

Returns the class id of the object.

Returns:
an id of the object's class


Member Data Documentation

FontManager * FontManager::instance = 0 [static, private]

The singleton instance of this Manager.

vector<fontEntry> FontManager::fonts [private]

The place to store all information about loaded textures.


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

Generated on Mon Jul 7 13:30:33 2008 for Firefly by  doxygen 1.5.6