Main Page | Class Hierarchy | Data Structures | File List | Data Fields | Globals

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, bool useDisplayList)
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     if(useDisplayList)
00024     {
00025         glList = glGenLists(1);
00026         glNewList( glList, GL_COMPILE);
00027     }
00028     
00029     for( unsigned int c = 0; c < numContours; ++c)
00030     {
00031         const FTContour* contour = vectoriser.Contour(c);
00032         
00033         glBegin( GL_LINE_LOOP);
00034             for( unsigned int pointIndex = 0; pointIndex < contour->PointCount(); ++pointIndex)
00035             {
00036                 FTPoint point = contour->Point(pointIndex);
00037                 glVertex2f( point.X() / 64.0f, point.Y() / 64.0f);
00038             }
00039         glEnd();
00040     }
00041 
00042     if(useDisplayList)
00043     {
00044         glEndList();
00045     }
00046 }
00047 
00048 
00049 FTOutlineGlyph::~FTOutlineGlyph()
00050 {
00051     glDeleteLists( glList, 1);
00052 }
00053 
00054 
00055 const FTPoint& FTOutlineGlyph::Render( const FTPoint& pen)
00056 {
00057     glTranslatef( pen.X(), pen.Y(), 0.0f);
00058 
00059     if( glList)
00060     {
00061         glCallList( glList);
00062     }
00063     
00064     return advance;
00065 }
00066 

Generated on Sun Dec 5 22:24:06 2004 for FTGL by doxygen 1.3.6