Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglBitmapFont Class Reference

#include <sglBitmapFont.hpp>

Inheritance diagram for sglBitmapFont::

sglObject sglBitmapFont8x13 sglBitmapFontGLX List of all members.

Public Methods

 sglBitmapFont ()
virtual ~sglBitmapFont ()
virtual sglBitmapFont* clone () const=0
void rasterString (const string &str) const
virtual void rasterString (const char *str, int len=-1) const=0
virtual unsigned int getHeight () const=0
virtual unsigned int getDescent () const=0
virtual unsigned int getCharWidth (char c) const=0
virtual unsigned int getStringWidth (const string &str) const

Static Public Methods

void setDefaultFont (sglBitmapFont *font)
sglBitmapFont* getDefaultFont ()

Detailed Description

sglBitmapFont is the base class for platform-specific bitmapped font classes: sglBitmapFontGLX (X windows systems), sglBitmapFontWGL (Microsoft windows systems), and sglBitmapFont8x13 (any system). The constructor takes a font specification whose details are platform specific. These classes also implement a rasterString() member function that renders a string at the current raster position. Characters should be limited to the ASCII range 0-127.

{\bf Example:}

\begin{verbatim} a subclass of sglBitmapFont specific to X11 sglBitmapFontGLX *fnt = NULL;

Display *dpy = glXGetCurrentDisplay(); XFontStruct *font = XLoadQueryFont(dpy, "fixed"); if (font) { sglBitmapFontGLX *fnt = new sglBitmapFontGLX(font->fid); fnt->rasterString("This is rendered at current raster position."); } \end{verbatim}

Definition at line 62 of file sglBitmapFont.hpp.


Constructor & Destructor Documentation

sglBitmapFont::sglBitmapFont ( ) [inline]
 

default constructor.

Definition at line 66 of file sglBitmapFont.hpp.

sglBitmapFont::~sglBitmapFont ( ) [inline, virtual]
 

destructor.

Definition at line 68 of file sglBitmapFont.hpp.


Member Function Documentation

sglBitmapFont * sglBitmapFont::clone ( ) const [pure virtual]
 

Create a copy of this font. The copy will have display lists that are valid for the current context.

Returns:
a copy of this font

Reimplemented in sglBitmapFont8x13, and sglBitmapFontGLX.

void sglBitmapFont::rasterString ( const string & str ) const [inline]
 

Renders a bitmap string at the current raster position. Characters should be limited to the ASCII range 0-127.

Parameters:
str   the string to render

Definition at line 80 of file sglBitmapFont.hpp.

void sglBitmapFont::rasterString ( const char * str,
int len = -1 ) const [pure virtual]
 

Renders a bitmap string at the current raster position. Characters should be limited to the ASCII range 0-127.

Parameters:
str   the string to render
len   the length of the string. If len is less than zero, strlen() will be used to determine the length.

Reimplemented in sglBitmapFont8x13, and sglBitmapFontGLX.

unsigned int sglBitmapFont::getHeight ( ) const [pure virtual]
 

Gets the height of the font in pixels.

Returns:
the height of the font in pixels

Reimplemented in sglBitmapFont8x13, and sglBitmapFontGLX.

unsigned int sglBitmapFont::getDescent ( ) const [pure virtual]
 

Gets the extent of the font below the baseline in pixels.

Returns:
the extent of the font below the baseline in pixels.

Reimplemented in sglBitmapFont8x13, and sglBitmapFontGLX.

unsigned int sglBitmapFont::getCharWidth ( char c ) const [pure virtual]
 

Gets the width of the given character.

Parameters:
c   the character whose width will be returned
Returns:
the width of the given character

Reimplemented in sglBitmapFont8x13, and sglBitmapFontGLX.

unsigned int sglBitmapFont::getStringWidth ( const string & str ) const [virtual]
 

Gets the width of the given string.

Parameters:
str   the string whose width will be returned
Returns:
the width of the given string

Reimplemented in sglBitmapFontGLX.

void sglBitmapFont::setDefaultFont ( sglBitmapFont * font ) [static]
 

Sets the default font to be used by sgl.

See also:
sglText
Parameters:
font   the new default font

sglBitmapFont* sglBitmapFont::getDefaultFont ( ) [inline, static]
 

Gets the default font used by sgl.

See also:
sglText
Returns:
the default font used by sgl

Definition at line 123 of file sglBitmapFont.hpp.


The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:06 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001