Main Page | File List | File Members

FTOutlineGlyph.cpp

Go to the documentation of this file.
00001 #include "FTOutlineGlyph.h" 00002 #include "FTVectoriser.h" 00003 00004 00005 FTOutlineGlyph::FTOutlineGlyph( 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 size_t numContours = vectoriser.ContourCount(); 00018 if ( ( numContours < 1) || ( vectoriser.PointCount() < 3)) 00019 { 00020 return; 00021 } 00022 00023 glList = glGenLists(1); 00024 glNewList( glList, GL_COMPILE); 00025 for( unsigned int c = 0; c < numContours; ++c) 00026 { 00027 const FTContour* contour = vectoriser.Contour(c); 00028 00029 glBegin( GL_LINE_LOOP); 00030 for( unsigned int p = 0; p < contour->PointCount(); ++p) 00031 { 00032 glVertex2f( contour->Point(p).x / 64.0f, contour->Point(p).y / 64.0f); 00033 } 00034 glEnd(); 00035 } 00036 glEndList(); 00037 } 00038 00039 00040 FTOutlineGlyph::~FTOutlineGlyph() 00041 { 00042 glDeleteLists( glList, 1); 00043 } 00044 00045 00046 float FTOutlineGlyph::Render( const FTPoint& pen) 00047 { 00048 if( glList) 00049 { 00050 glTranslatef( pen.x, pen.y, 0); 00051 glCallList( glList); 00052 glTranslatef( -pen.x, -pen.y, 0); 00053 } 00054 00055 return advance; 00056 } 00057

Generated on Tue Jul 27 22:31:15 2004 for FTGL by doxygen 1.3.7