1
#include "FTOutlineGlyph.h"
2
#include "FTVectoriser.h"
5
FTOutlineGlyph::FTOutlineGlyph( FT_GlyphSlot glyph)
9
if( ft_glyph_format_outline != glyph->format)
11
err = 0x14; // Invalid_Outline
15
FTVectoriser vectoriser( glyph);
17
size_t numContours = vectoriser.ContourCount();
18
if ( ( numContours < 1) || ( vectoriser.PointCount() < 3))
23
glList = glGenLists(1);
24
glNewList( glList, GL_COMPILE);
25
for( unsigned int c = 0; c < numContours; ++c)
27
const FTContour* contour = vectoriser.Contour(c);
29
glBegin( GL_LINE_LOOP);
30
for( unsigned int p = 0; p < contour->PointCount(); ++p)
32
glVertex2f( contour->Point(p).x / 64.0f, contour->Point(p).y / 64.0f);
40
FTOutlineGlyph::~FTOutlineGlyph()
42
glDeleteLists( glList, 1);
46
float FTOutlineGlyph::Render( const FTPoint& pen)
50
glTranslatef( pen.x, pen.y, 0);
52
glTranslatef( -pen.x, -pen.y, 0);