Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

OGLFT::Texture Class Reference

This is the base class of the texture style. More...

#include <OGLFT.h>

Inheritance diagram for OGLFT::Texture::

OGLFT::Face OGLFT::GrayscaleTexture OGLFT::MonochromeTexture OGLFT::TranslucentTexture List of all members.

Public Methods

 Texture (const char *filename, float point_size=12, FT_UInt resolution=100)
 Texture (FT_Face face, float point_size=12, FT_UInt resolution=100)
virtual ~Texture (void)
void setCharacterRotationX (GLfloat character_rotation_x)
void setCharacterRotationY (GLfloat character_rotation_y)
void setCharacterRotationZ (GLfloat character_rotation_z)
GLfloat characterRotationX (void) const
GLfloat characterRotationY (void) const
GLfloat characterRotationZ (void) const
double height (void) const
BBox measure (unsigned char c)
BBox measure (const QChar c)
BBox measure (const char *s)
BBox measure (const QString &format, double number)

Protected Types

typedef std::map< FT_UInt,
TextureInfo
GlyphTexObjs
 Type of the cache of defined glyph to texture objects mapping.

typedef GlyphTexObjs::const_iterator GTOCI
 A convenience definition of the iterator over the glyph to texture object map.

typedef GlyphTexObjs::iterator GTOI
 A convenience definition of the iterator over the glyph to texture object map.


Protected Methods

unsigned int nearestPowerCeil (unsigned int a)
virtual void bindTexture (FT_Face face, FT_UInt glyph_index)=0

Protected Attributes

struct {
   bool   active_
   GLfloat   x_
   GLfloat   y_
   GLfloat   z_
character_rotation_
 Angle of rotation of characters relative to text orientation.

GlyphTexObjs glyph_texobjs_
 Cache of defined glyph texture objects.


Detailed Description

This is the base class of the texture style.


Constructor & Destructor Documentation

OGLFT::Texture::Texture ( const char * filename,
float point_size = 12,
FT_UInt resolution = 100 )
 

Parameters:
file   the filename which contains the font face.
point_size   the initial point size of the font to generate. A point is essentially 1/72th of an inch. Defaults to 12.
resolution   the pixel density of the display in dots per inch (DPI). Defaults to 100 DPI.

OGLFT::Texture::Texture ( FT_Face face,
float point_size = 12,
FT_UInt resolution = 100 )
 

Parameters:
face   open FreeType FT_Face.
point_size   the initial point size of the font to generate. A point is essentially 1/72th of an inch. Defaults to 12.
resolution   the pixel density of the display in dots per inch (DPI). Defaults to 100 DPI.

OGLFT::Texture::~Texture ( void ) [virtual]
 

The texture destructor doesn't really do anything.


Member Function Documentation

void OGLFT::Texture::bindTexture ( FT_Face face,
FT_UInt glyph_index ) [protected, pure virtual]
 

This is all that distinguishes the various texture styles. Each subclass defines this method as appropriate. Once the texture is bound, it is rendered the same in all cases.

Parameters:
face   FT_Face containing the glyph to render.
glyph_index   index of glyph in face.

GLfloat OGLFT::Texture::characterRotationX ( void ) const [inline]
 

Returns:
the character rotation in the X direction.

GLfloat OGLFT::Texture::characterRotationY ( void ) const [inline]
 

Returns:
the character rotation in the Y direction.

GLfloat OGLFT::Texture::characterRotationZ ( void ) const [inline, virtual]
 

Returns:
the character rotation in the Z direction.

Reimplemented from OGLFT::Face.

double OGLFT::Texture::height ( void ) const [virtual]
 

Returns:
the height (i.e., line spacing) at the current character size.

Reimplemented from OGLFT::Face.

BBox OGLFT::Texture::measure ( const QString & format,
double number ) [inline, virtual]
 

Implement measuring a formatted number

Parameters:
format   the format string
number   to value to format
Returns:
the bounding box of the formatted number

Reimplemented from OGLFT::Face.

BBox OGLFT::Texture::measure ( const char * s ) [inline, virtual]
 

Measure a string of characters. Note: currently, this merely calls Face's measure routine.

Parameters:
s   string of (latin1) characters to measure
Returns:
the bounding box of s.

Reimplemented from OGLFT::Face.

BBox OGLFT::Texture::measure ( const QChar c ) [virtual]
 

Implement measuring a character in a texture face.

Parameters:
c   the (UNICODE) character to measure
Returns:
the bounding box of c.

Reimplemented from OGLFT::Face.

BBox OGLFT::Texture::measure ( unsigned char c ) [virtual]
 

Implement measuring a character in a texture face.

Parameters:
c   the (latin1) character to measure
Returns:
the bounding box of c.

Reimplemented from OGLFT::Face.

unsigned int OGLFT::Texture::nearestPowerCeil ( unsigned int a ) [protected]
 

OpenGL texture maps have to be a power of 2 in width and height (including apparently 1 = 2**0 ). This function returns the next higher power of 2 of the argument. If the argument is already a power of 2, you just get that back.

Parameters:
a   width or height of an image.
Returns:
value of a rounded to nearest, higher power of 2.

void OGLFT::Texture::setCharacterRotationX ( GLfloat character_rotation_x )
 

Set the individual character rotation in the X direction.

Parameters:
character_rotation_x   angle in degrees of X rotation.

void OGLFT::Texture::setCharacterRotationY ( GLfloat character_rotation_y )
 

Set the individual character rotation in the Y direction.

Parameters:
character_rotation_y   angle in degrees of Y rotation.

void OGLFT::Texture::setCharacterRotationZ ( GLfloat character_rotation_z ) [virtual]
 

Set the individual character rotation in the Z direction.

Parameters:
character_rotation_z   angle in degrees of Z rotation.

Reimplemented from OGLFT::Face.


Member Data Documentation

bool OGLFT::Texture::active_
 

Is character rotation non-zero? (faster than checking all the other values.).

GLfloat OGLFT::Texture::x_
 

Angle of rotation in the X direction.

GLfloat OGLFT::Texture::y_
 

Angle of rotation in the Y direction.

GLfloat OGLFT::Texture::z_
 

Angle of rotation in the Z direction.


The documentation for this class was generated from the following files:
Generated at Fri Jul 12 10:47:16 2002 for OGLFT by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001