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

sglTextureFont Class Reference

#include <sglTextureFont.hpp>

Inheritance diagram for sglTextureFont::

sglObject List of all members.

Public Methods

 sglTextureFont (const sglBitmapFont &font, bool use_invalid_char, char invalid_char)
 sglTextureFont (const sglBitmapFont &font, const vector< char > &valid_chars, bool use_invalid_char, char invalid_char)
 ~sglTextureFont ()
unsigned int getStringInfo (const string &str, sglVec3f *coord, sglVec2f *tex_coords, float scale, const sglVec3f &offset, bool vertical=false) const
sglTexture2DgetTexture () const
unsigned int getHeight () const
unsigned int getCharWidth (char c) const
unsigned int getCharWidthMax () const
unsigned int getStringWidth (const string &str) const

Detailed Description

The sglTextureFont class represents a font with a texture. This allows the user of the texture to generate text (by texture mapping quads) in 3-space. The texture defaults to eLINEAR min filter and eLINEAR mag filter. The user may wish to change these defaults

Definition at line 43 of file sglTextureFont.hpp.


Constructor & Destructor Documentation

sglTextureFont::sglTextureFont ( const sglBitmapFont & font,
bool use_invalid_char,
char invalid_char )
 

Constructs a complete texture font from a bitmap font. All characters in the range of 0-127 will be considered valid, if they have non-zero width.

Parameters:
font   A bitmap font to use as a source for generating the texture.
use_invalid_char   If true, any character that is not represented by the font, will be rendered as the given invalid_char. If false, invalid characters will be treated as non-existant (zero width).
invalid_char   The character to replace invalid characters with if use_invalid_char is true.

sglTextureFont::sglTextureFont ( const sglBitmapFont & font,
const vector< char > & valid_chars,
bool use_invalid_char,
char invalid_char )
 

Constructs a partial texture font from a bitmap font. Only the specified characters will be considered valid. Careful use of this constructor may generate substantially smaller textures than the other constructor.

Parameters:
font   A bitmap font to use as a source for generating the texture.
valid_chars   The set of characters to be treated as valid.
use_invalid_char   If true, any character that is not represented by the font, will be rendered as the given invalid_char. If false, invalid characters will be treated as non-existant (zero width).
invalid_char   The character to replace invalid characters with if use_invalid_char is true.

sglTextureFont::~sglTextureFont ( )
 

destructor.


Member Function Documentation

unsigned int sglTextureFont::getStringInfo ( const string & str,
sglVec3f * coord,
sglVec2f * tex_coords,
float scale,
const sglVec3f & offset,
bool vertical = false ) const
 

Queries all the information required to render a text string with this font.

Parameters:
str   The string to be rendered.
coord   Must point to an array of at least 4*str.size() elements. On return will contain coordinate values for each valid character, offset from (0,0,0). The coordinates are in XZ plane.
tex_coords   Must point to an array of at least 4*str.size() elements. On return will contain texture coordinate values for each valid character.
scale   The desired height of the string in world space.
vertical   If true, the text will run in the negative z direction, otherwize in the positive x direction.

sglTexture2D * sglTextureFont::getTexture ( ) const [inline]
 

Gets the texture.

Returns:
The fonts texture.

Definition at line 106 of file sglTextureFont.hpp.

unsigned int sglTextureFont::getHeight ( ) const
 

Gets the height of the font in texels.

Returns:
the height of the font in texels

unsigned int sglTextureFont::getCharWidth ( char c ) const
 

Gets the width of the given character in texels.

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

unsigned int sglTextureFont::getCharWidthMax ( ) const [inline]
 

Gets the width in texels of the widest character in this font.

Returns:
the width in texels of the widest character in this font

Definition at line 122 of file sglTextureFont.hpp.

unsigned int sglTextureFont::getStringWidth ( const string & str ) const
 

Gets the width in texels of the given string.

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


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