cFont Class Reference

cFont is a generic and pure virtual font interface, to be subclassed by platform-specific implementations. For the simplest, most portable approach, use this class and the static method createFont", which returns an actual font object. You may also create subclass font types directly (see below). More...

#include <CFont.h>

List of all members.

Public Member Functions

virtual int renderString (const char *a_str)=0
 Renders a single-line string.
virtual void setFontFace (const char *a_faceName)
 Change the font face; may require re-initializing the font.
virtual void getFontFace (char *a_faceName) const
 Get the current font face.
virtual void setPointSize (const float &a_pointSize)
 Change the font size; may require re-initializing the font.
virtual float getPointSize () const
 Get the current font size.
 cFont ()
 Constructor.
virtual ~cFont ()
 Destructor.
virtual int getCharacterWidth (const unsigned char &a_char)
 Get the width of a particular character.

Static Public Member Functions

static cFontcreateFont ()
 Use this to obtain an actual, non-virtual font object.
static cFontcreateFont (const cFont *oldFont)
 Use this to copy data from an existing font object.

Protected Attributes

float m_pointSize
 The point size of the font.
char m_fontFace [255]
 The font face name.
int m_char_widths [255]
 The width of each character in our font.


Detailed Description

cFont is a generic and pure virtual font interface, to be subclassed by platform-specific implementations. For the simplest, most portable approach, use this class and the static method createFont", which returns an actual font object. You may also create subclass font types directly (see below).

Specific implementations can be found later in this file.


Constructor & Destructor Documentation

cFont::cFont (  ) 

Constructor.

Default constructor for abstract class cFont


Member Function Documentation

cFont * cFont::createFont (  )  [static]

Use this to obtain an actual, non-virtual font object.

Use this to obtain an actual, non-virtual font object

Returns:
Returns a pointer to an actual cFont object that you can use for rendering. The caller is responsible for deleting this object. Returns 0 if no font can be constructed.

cFont * cFont::createFont ( const cFont oldFont  )  [static]

Use this to copy data from an existing font object.

Use this to copy data from an existing font object

Returns:
Returns a pointer to an actual cFont object that you can use for rendering. The caller is responsible for deleting this object. Returns 0 if no font can be constructed.

void cFont::setFontFace ( const char *  a_faceName  )  [virtual]

Change the font face; may require re-initializing the font.

Change the font face, possibly marking the font for re-initialization

Parameters:
a_faceName The new face name

int cFont::getCharacterWidth ( const unsigned char &  a_char  )  [virtual]

Get the width of a particular character.

Get the width of a particular character

Returns:
Returns the width of this character in pixels, or -1 for an error
Parameters:
a_char The character (e.g. 'a') to look up. Characters less than 32 ('A') will generate errors.


The documentation for this class was generated from the following files:
Generated on Mon Jun 11 09:41:47 2007 for CHAI 3D by  doxygen 1.5.2