Classes | Modules | Typedefs | Functions | Variables

Glut Font Library
[Wavepacket GLUT Libraries]

A font helper library. More...

Collaboration diagram for Glut Font Library:

Classes

struct  glut::font_rect_t
 font sizing information More...
class  glut::Font
 a basic font class. More...
class  glut::FontManager
 the font manager More...

Modules

 Glut Font Effects
 

Font effects based on the Glut Font Library library.


Typedefs

typedef rect2d_t< int > glut::pixel_rect_t
 standard 2D pixel rect

Functions

void glut::font_rect_t::clear (void) throw ()
void glut::font_rect_t::getPixelRect (OUT pixel_rect_t &pr) const throw ()
virtual const char * glut::Font::getName (void) const =0 throw ()
virtual font_rect_t glut::Font::getBoundingRect (IN const char *text)=0
virtual void glut::Font::display (IN float x, IN float y, IN float z, IN const char *text)=0
virtual bool glut::Font::canScale (void) const =0 throw ()
virtual bool glut::Font::setFaceSize (IN float pointSize)=0
virtual float glut::Font::getFaceSize (void) const =0 throw ()
virtual int glut::Font::getLineHeight (void) const =0 throw ()
virtual smart_ptr< Font > glut::FontManager::getFont (IN nstream::Stream *stream)=0
 retrieve (and create if necessary) a font from the given true type font file (.ttf) stream.
static smart_ptr< FontManager > glut::FontManager::create (void)
smart_ptr< Font > glut::getDefaultFont (void)
 retrieve the default font (throws if there isn't one)
bool glut::scaleFontToPixelHeight (IO Font *font, IN const char *textToScale, IN int desiredPixelHeight)
 scale the given font to the specified height in pixels.

Variables

int glut::font_rect_t::lead
 pixels leading (to left of) draw origin
int glut::font_rect_t::trail
 pixels trailing (to right of) draw origin
int glut::font_rect_t::drop
 pixels falling below draw origin
int glut::font_rect_t::rise
 pixels above draw origin

Detailed Description

A font helper library.

Keeps other code abstracted from the details of font implementation. Currently this is a wrapper on top of the FTGL library.

WARNING: this library is used for 2D font rendering. That is, it assumes that we are in 2D rendering mode (see the glut::push2D() and pop2D() methods). This library uses the wavepacket convention for 2D coordinates: y=0 is the TOP of the screen, and y=height is the BOTTOM of the screen. That is a bit unusual: OpenGL flips that convention (and OpenGL's convention is probably better). But for legacy reasons, this library uses the wavepacket convention.

This means, for instance, that it is *very* awkward to attempt to use these routines to render while in 3D rendering mode.


Typedef Documentation

typedef rect2d_t<int> glut::pixel_rect_t

standard 2D pixel rect

Definition at line 70 of file glut-font.h.


Function Documentation

void glut::font_rect_t::clear ( void   )  throw () [inline, inherited]

Definition at line 78 of file glut-font.h.

void glut::font_rect_t::getPixelRect ( OUT pixel_rect_t pr  )  const throw () [inline, inherited]

Definition at line 81 of file glut-font.h.

virtual const char* glut::Font::getName ( void   )  const throw () [pure virtual, inherited]
virtual font_rect_t glut::Font::getBoundingRect ( IN const char *  text  )  [pure virtual, inherited]
virtual void glut::Font::display ( IN float  x,
IN float  y,
IN float  z,
IN const char *  text 
) [pure virtual, inherited]
virtual bool glut::Font::canScale ( void   )  const throw () [pure virtual, inherited]
virtual bool glut::Font::setFaceSize ( IN float  pointSize  )  [pure virtual, inherited]
virtual float glut::Font::getFaceSize ( void   )  const throw () [pure virtual, inherited]
virtual int glut::Font::getLineHeight ( void   )  const throw () [pure virtual, inherited]
virtual smart_ptr<Font> glut::FontManager::getFont ( IN nstream::Stream *  stream  )  [pure virtual, inherited]

retrieve (and create if necessary) a font from the given true type font file (.ttf) stream.

If stream is null, a default font will be used (if available). Always returns non-null (throws an exception on any error).

smart_ptr< FontManager > glut::FontManager::create ( void   )  [static, inherited]

Definition at line 289 of file glut-font.cpp.

smart_ptr< Font > glut::getDefaultFont ( void   ) 

retrieve the default font (throws if there isn't one)

bool glut::scaleFontToPixelHeight ( IO Font *  font,
IN const char *  textToScale,
IN int  desiredPixelHeight 
)

scale the given font to the specified height in pixels.

Returns false if this was not possible (for instance, the font isn't scalable). Caller must specify what text they are scaling for (capital M is common)


Variable Documentation

int glut::font_rect_t::lead [inherited]

pixels leading (to left of) draw origin

Definition at line 89 of file glut-font.h.

int glut::font_rect_t::trail [inherited]

pixels trailing (to right of) draw origin

Definition at line 90 of file glut-font.h.

int glut::font_rect_t::drop [inherited]

pixels falling below draw origin

Definition at line 91 of file glut-font.h.

int glut::font_rect_t::rise [inherited]

pixels above draw origin

Definition at line 92 of file glut-font.h.