libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OGLFT::Polygonal Class Reference

This is the base class of the polygonal styles: outline, filled and solid. More...

#include <moOGLFT.h>

Inheritance diagram for OGLFT::Polygonal:
OGLFT::Face OGLFT::Filled OGLFT::Outline OGLFT::Solid

Classes

struct  VertexInfo
 

Public Member Functions

 Polygonal (const char *filename, float point_size=12, FT_UInt resolution=100)
 
 Polygonal (FT_Face face, float point_size=12, FT_UInt resolution=100)
 
virtual ~Polygonal (void)
 
void setTessellationSteps (unsigned int tessellation_steps)
 
unsigned int tessellationSteps (void) const
 
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
 
void setColorTess (ColorTess *color_tess)
 
ColorTesscolorTess (void) const
 
void setTextureTess (TextureTess *texture_tess)
 
TextureTesstextureTess (void) const
 
double height (void) const
 
BBox measure (unsigned char c)
 
BBox measure (const char *s)
 
- Public Member Functions inherited from OGLFT::Face
 Face (const char *filename, float point_size=12, FT_UInt resolution=100)
 
 Face (FT_Face face, float point_size=12, FT_UInt resolution=100)
 
virtual ~Face (void)
 
bool isValid (void) const
 
bool addAuxiliaryFace (const char *filename)
 
bool addAuxiliaryFace (FT_Face face)
 
void setCompileMode (enum GlyphCompileMode compile_mode)
 
enum GlyphCompileMode compileMode (void) const
 
void setPointSize (float point_size)
 
float pointSize (void)
 
void setResolution (FT_UInt resolution)
 
FT_UInt resolution (void)
 
void setAdvance (bool advance)
 
bool advance (void) const
 
void setForegroundColor (GLfloat red=0.0, GLfloat green=0.0, GLfloat blue=0.0, GLfloat alpha=1.0)
 
void setForegroundColor (const GLfloat foreground_color[4])
 
GLfloat foregroundRed (void) const
 
GLfloat foregroundGreen (void) const
 
GLfloat foregroundBlue (void) const
 
GLfloat foregroundAlpha (void) const
 
void setBackgroundColor (GLfloat red=1.0, GLfloat green=1.0, GLfloat blue=1.0, GLfloat alpha=0.0)
 
void setBackgroundColor (const GLfloat background_color[4])
 
GLfloat backgroundRed (void) const
 
GLfloat backgroundGreen (void) const
 
GLfloat backgroundBlue (void) const
 
GLfloat backgroundAlpha (void) const
 
void setCharacterRotationReference (unsigned char c)
 
void setStringRotation (GLfloat string_rotation)
 
GLfloat stringRotation (void) const
 
void setHorizontalJustification (enum HorizontalJustification horizontal_justification)
 
enum HorizontalJustification horizontalJustification (void) const
 
void setVerticalJustification (enum VerticalJustification vertical_justification)
 
enum VerticalJustification verticaljustification (void) const
 
void setCharacterDisplayLists (const DisplayLists &character_display_lists)
 
DisplayListscharacterDisplayLists (void)
 
virtual BBox measureRaw (const char *s)
 
GLuint compile (const char *s)
 
GLuint compile (unsigned char c)
 
void draw (const char *s)
 
void draw (unsigned char c)
 
void draw (GLfloat x, GLfloat y, unsigned char c)
 
void draw (GLfloat x, GLfloat y, GLfloat z, unsigned char c)
 
void draw (GLfloat x, GLfloat y, const char *s)
 
void draw (GLfloat x, GLfloat y, GLfloat z, const char *s)
 
int ascender (void)
 
int descender (void)
 

Protected Types

typedef std::list< VertexInfo * > VertexInfoList
 Normally, we will consider a list of vertices. More...
 
typedef
VertexInfoList::const_iterator 
VILCI
 A convenience definition of the iterator over the list of vertices. More...
 
typedef VertexInfoList::iterator VILI
 A convenience definition of the iterator over the list of vertices. More...
 
- Protected Types inherited from OGLFT::Face
typedef std::map< FT_UInt, GLuint > GlyphDLists
 Type of the cache of defined glyph to display list mapping. More...
 
typedef GlyphDLists::const_iterator GDLCI
 
typedef GlyphDLists::iterator GDLI
 

Protected Member Functions

void clearCaches (void)
 
- Protected Member Functions inherited from OGLFT::Face
virtual void renderGlyph (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. More...
 
unsigned int tessellation_steps_
 
double delta_
 
double delta2_
 
double delta3_
 
double vector_scale_
 
FT_Outline_Funcs interface_
 Callbacks for FreeType glyph decomposition into outlines. More...
 
VertexInfo last_vertex_
 
VertexInfoList vertices_
 
bool contour_open_
 
ColorTesscolor_tess_
 
TextureTesstexture_tess_
 
- Protected Attributes inherited from OGLFT::Face
std::vector< FaceData > faces_
 
bool valid_
 Did a font load OK? More...
 
enum GlyphCompileMode compile_mode_
 Glyph display list creation mode. More...
 
float point_size_
 Nominal point size. More...
 
FT_UInt resolution_
 Display resolution in pixels per inch. More...
 
bool advance_
 Does rendering text affect the MODELVIEW matrix? More...
 
GLfloat foreground_color_ [4]
 
GLfloat background_color_ [4]
 Background color (what modes would use this?) More...
 
enum HorizontalJustification horizontal_justification_
 PHIGS-like horizontal positioning of text. More...
 
enum VerticalJustification vertical_justification_
 PHIGS-like vertical positioning of text. More...
 
GLfloat string_rotation_
 Rotate an entire string in the Z plane. More...
 
FT_UInt rotation_reference_glyph_
 
FT_Face rotation_reference_face_
 The rotation reference character could be in any face. More...
 
GLfloat rotation_offset_y_
 
GlyphDLists glyph_dlists_
 Cache of defined glyph display lists. More...
 
DisplayLists character_display_lists_
 

Static Protected Attributes

static const unsigned int DEFAULT_TESSELLATION_STEPS = 4
 

Additional Inherited Members

- Public Types inherited from OGLFT::Face
enum  HorizontalJustification { LEFT, ORIGIN, CENTER, RIGHT }
 
enum  VerticalJustification { BOTTOM, BASELINE, MIDDLE, TOP }
 
enum  GlyphCompileMode { COMPILE, IMMEDIATE }
 

Detailed Description

This is the base class of the polygonal styles: outline, filled and solid.

In the polygonal styles, the detailed geometric outlines of the glyphs are extracted from the font file and rendered as polygons.

Definition at line 1078 of file moOGLFT.h.

Member Typedef Documentation

typedef std::list< VertexInfo * > OGLFT::Polygonal::VertexInfoList
protected

Normally, we will consider a list of vertices.

Definition at line 1214 of file moOGLFT.h.

typedef VertexInfoList::const_iterator OGLFT::Polygonal::VILCI
protected

A convenience definition of the iterator over the list of vertices.

Definition at line 1217 of file moOGLFT.h.

typedef VertexInfoList::iterator OGLFT::Polygonal::VILI
protected

A convenience definition of the iterator over the list of vertices.

Definition at line 1220 of file moOGLFT.h.

Constructor & Destructor Documentation

OGLFT::Polygonal::Polygonal ( const char *  filename,
float  point_size = 12,
FT_UInt  resolution = 100 
)
Parameters
filenamethe filename which contains the font face.
point_sizethe initial point size of the font to generate. A point is essentially 1/72th of an inch. Defaults to 12.
resolutionthe pixel density of the display in dots per inch (DPI). Defaults to 100 DPI.

Definition at line 1958 of file moOGLFT.cpp.

OGLFT::Polygonal::Polygonal ( FT_Face  face,
float  point_size = 12,
FT_UInt  resolution = 100 
)
Parameters
faceopen Freetype FT_Face.
point_sizethe initial point size of the font to generate. A point is essentially 1/72th of an inch. Defaults to 12.
resolutionthe pixel density of the display in dots per inch (DPI). Defaults to 100 DPI.

Definition at line 1966 of file moOGLFT.cpp.

OGLFT::Polygonal::~Polygonal ( void  )
virtual

The Polygonal destructor doesn't do anything in particular.

Definition at line 2007 of file moOGLFT.cpp.

Member Function Documentation

GLfloat OGLFT::Polygonal::characterRotationX ( void  ) const
inline
Returns
the character rotation in the X direction.

Definition at line 1310 of file moOGLFT.h.

GLfloat OGLFT::Polygonal::characterRotationY ( void  ) const
inline
Returns
the character rotation in the Y direction.

Definition at line 1318 of file moOGLFT.h.

GLfloat OGLFT::Polygonal::characterRotationZ ( void  ) const
inlinevirtual
Returns
the character rotation in the Z direction.

Implements OGLFT::Face.

Definition at line 1326 of file moOGLFT.h.

void OGLFT::Polygonal::clearCaches ( void  )
protectedvirtual

The different styles have different caching needs (well, really only the texture style currently has more than the display list cache).

Implements OGLFT::Face.

Definition at line 2227 of file moOGLFT.cpp.

ColorTess* OGLFT::Polygonal::colorTess ( void  ) const
inline
Returns
the color tesselation object.

Definition at line 1341 of file moOGLFT.h.

double OGLFT::Polygonal::height ( void  ) const
virtual
Returns
the height (i.e., line spacing) at the current character size.

Implements OGLFT::Face.

Definition at line 2127 of file moOGLFT.cpp.

BBox OGLFT::Polygonal::measure ( unsigned char  c)
virtual

Implement measuring a character in a polygonal face.

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

Implements OGLFT::Face.

Definition at line 2137 of file moOGLFT.cpp.

BBox OGLFT::Polygonal::measure ( const char *  s)
inlinevirtual

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

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

Reimplemented from OGLFT::Face.

Definition at line 1385 of file moOGLFT.h.

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

Set the individual character rotation in the X direction.

Parameters
character_rotation_xangle in degrees of the X rotation.

Definition at line 2050 of file moOGLFT.cpp.

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

Set the individual character rotation in the Y direction.

Parameters
character_rotation_yangle in degrees of the Y rotation.

Definition at line 2065 of file moOGLFT.cpp.

void OGLFT::Polygonal::setCharacterRotationZ ( GLfloat  character_rotation_z)
virtual

Set the individual character rotation in the Z direction.

Parameters
character_rotation_zangle in degrees of the Z rotation.

Implements OGLFT::Face.

Definition at line 2080 of file moOGLFT.cpp.

void OGLFT::Polygonal::setColorTess ( ColorTess color_tess)

Set an optional color tesselation object. Each tesselated vertex is passed to this object, which returns a color for that position in space.

Parameters
color_tessthe color tesselation object.

Definition at line 2015 of file moOGLFT.cpp.

void OGLFT::Polygonal::setTessellationSteps ( unsigned int  tessellation_steps)

TrueType and Type1 files describe the boundaries of glyphs with quadratic and cubic curves, respectively. Since OpenGL can only really draw straight lines, these curves have to be tessellated. The number of steps used is fixed for all glyphs in the face, but can be changed through this method. Other notes: This value is only applicable for Outline, Filled and Solid styles. Changing this value invalidates any cached display lists for glyphs in this face.

Parameters
tessellation_stepsthe number of steps to tessellate each curved segment of a glyph outline.

Definition at line 2034 of file moOGLFT.cpp.

void OGLFT::Polygonal::setTextureTess ( TextureTess texture_tess)

Set an optional texture coordinate tesselation object. Each tessellated vertex is passed to this object, which returns texture coordinates for that position in space.

Parameters
texture_tessthe texture coordinate tesselation object.

Definition at line 2025 of file moOGLFT.cpp.

unsigned int OGLFT::Polygonal::tessellationSteps ( void  ) const
inline
Returns
the number of steps used to tessellate curves in the polygonal font types.

Definition at line 1284 of file moOGLFT.h.

TextureTess* OGLFT::Polygonal::textureTess ( void  ) const
inline
Returns
the texture coordinate tesselation object.

Definition at line 1355 of file moOGLFT.h.

Member Data Documentation

bool OGLFT::Polygonal::active_

Definition at line 1084 of file moOGLFT.h.

struct { ... } OGLFT::Polygonal::character_rotation_

Angle of rotation of characters relative to text orientation.

ColorTess* OGLFT::Polygonal::color_tess_
protected

The user can provide a ColorTess object which computes a color for each tesselated vertex.

Definition at line 1235 of file moOGLFT.h.

bool OGLFT::Polygonal::contour_open_
protected

As GLU tessellation proceeds, new contours open with every call to moveTo.

Definition at line 1231 of file moOGLFT.h.

const unsigned int OGLFT::Polygonal::DEFAULT_TESSELLATION_STEPS = 4
staticprotected

Default number of steps to break TrueType and Type1 arcs into. (Note: this looks good to me, anyway)

Definition at line 1110 of file moOGLFT.h.

double OGLFT::Polygonal::delta2_
protected

Definition at line 1097 of file moOGLFT.h.

double OGLFT::Polygonal::delta3_
protected

Definition at line 1097 of file moOGLFT.h.

double OGLFT::Polygonal::delta_
protected

When curves are tessellated, we use the forward difference algorithm from Foley and van Dam for parametric curves (pg. 511 of 2nd Ed. in C). So, the step size, delta, is in the parametric variable which is always on the interval [0,1]. Therefore, delta = 1/tessellation_steps

Definition at line 1097 of file moOGLFT.h.

FT_Outline_Funcs OGLFT::Polygonal::interface_
protected

Callbacks for FreeType glyph decomposition into outlines.

Definition at line 1106 of file moOGLFT.h.

VertexInfo OGLFT::Polygonal::last_vertex_
protected

Buffers the last control point as the outline of a glyph is decomposed.

Definition at line 1211 of file moOGLFT.h.

unsigned int OGLFT::Polygonal::tessellation_steps_
protected

The tessellation of curves is pretty crude; regardless of length, use the same number of increments (and as near as I can tell, this is more than sufficient unless the glyph takes up the whole screen).

Definition at line 1091 of file moOGLFT.h.

TextureTess* OGLFT::Polygonal::texture_tess_
protected

The user can provide a TextureTess object which computes texture coordinates for each tesselated vertex.

Definition at line 1239 of file moOGLFT.h.

double OGLFT::Polygonal::vector_scale_
protected

For vector rendition modes, FreeType is allowed to generate the lines and arcs at the original face definition resolution. To get to the proper glyph size, the vertices are scaled before they're passed to the GLU tessellation routines.

Definition at line 1103 of file moOGLFT.h.

VertexInfoList OGLFT::Polygonal::vertices_
protected

As curves are decomposed out of the glyph, their vertices are passed along to the GLU tessellation functions. These vertices have to hang around until gluTessContourEnd is called.

Definition at line 1227 of file moOGLFT.h.

GLfloat OGLFT::Polygonal::x_

Definition at line 1085 of file moOGLFT.h.

GLfloat OGLFT::Polygonal::y_

Definition at line 1085 of file moOGLFT.h.

GLfloat OGLFT::Polygonal::z_

Definition at line 1085 of file moOGLFT.h.


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