Main Page | File List | File Members

FTPolyGlyph.cpp

Go to the documentation of this file.
00001 #include "FTPolyGlyph.h" 00002 #include "FTVectoriser.h" 00003 00004 00005 FTPolyGlyph::FTPolyGlyph( FT_GlyphSlot glyph) 00006 : FTGlyph( glyph), 00007 glList(0) 00008 { 00009 if( ft_glyph_format_outline != glyph->format) 00010 { 00011 err = 0x14; // Invalid_Outline 00012 return; 00013 } 00014 00015 FTVectoriser vectoriser( glyph); 00016 00017 if(( vectoriser.ContourCount() < 1) || ( vectoriser.PointCount() < 3)) 00018 { 00019 return; 00020 } 00021 00022 vectoriser.MakeMesh( 1.0); 00023 00024 glList = glGenLists( 1); 00025 glNewList( glList, GL_COMPILE); 00026 00027 const FTMesh* mesh = vectoriser.GetMesh(); 00028 for( unsigned int index = 0; index < mesh->TesselationCount(); ++index) 00029 { 00030 const FTTesselation* subMesh = mesh->Tesselation( index); 00031 unsigned int polyonType = subMesh->PolygonType(); 00032 00033 glBegin( polyonType); 00034 for( unsigned int x = 0; x < subMesh->PointCount(); ++x) 00035 { 00036 glVertex3f( subMesh->Point(x).x / 64.0f, 00037 subMesh->Point(x).y / 64.0f, 00038 0.0f); 00039 } 00040 glEnd(); 00041 } 00042 glEndList(); 00043 } 00044 00045 00046 FTPolyGlyph::~FTPolyGlyph() 00047 { 00048 glDeleteLists( glList, 1); 00049 } 00050 00051 00052 float FTPolyGlyph::Render( const FTPoint& pen) 00053 { 00054 if( glList) 00055 { 00056 glTranslatef( pen.x, pen.y, 0); 00057 glCallList( glList); 00058 glTranslatef( -pen.x, -pen.y, 0); 00059 } 00060 00061 return advance; 00062 }

Generated on Fri Aug 13 13:40:45 2004 for FTGL by doxygen 1.3.7