cFont Class Reference
[Widgets]

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. More...

#include <CFont.h>

Inheritance diagram for cFont:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 cFont ()
 Constructor of cFont.
virtual ~cFont ()
 Destructor of cFont.
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.
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 of cFont.

Default constructor for abstract class cFont.


Member Function Documentation

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.

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.

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.

Reimplemented in cGLUTBitmapFont, and cWin32BitmapFont.

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

Reimplemented in cWin32BitmapFont.


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


CHAI3D 2.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2009 - CHAI 3D
All Rights Reserved.