Logo Search packages:      
Sourcecode: blender version File versions

FTOutlineGlyph::FTOutlineGlyph ( FT_GlyphSlot  glyph  ) 

Constructor. Sets the Error to Invalid_Outline if the glyphs isn't an outline.

Parameters:
glyph The Freetype glyph to be processed

Definition at line 5 of file FTOutlineGlyph.cpp.

References FTVectoriser::Contour(), FTVectoriser::ContourCount(), FTGlyph::err, glList, FTContour::Point(), FTContour::PointCount(), FTVectoriser::PointCount(), FTPoint::x, and FTPoint::y.

:   FTGlyph( glyph),
    glList(0)
{
    if( ft_glyph_format_outline != glyph->format)
    {
        err = 0x14; // Invalid_Outline
        return;
    }

    FTVectoriser vectoriser( glyph);

    size_t numContours = vectoriser.ContourCount();
    if ( ( numContours < 1) || ( vectoriser.PointCount() < 3))
    {
        return;
    }

    glList = glGenLists(1);
    glNewList( glList, GL_COMPILE);
        for( unsigned int c = 0; c < numContours; ++c)
        {
            const FTContour* contour = vectoriser.Contour(c);
            
            glBegin( GL_LINE_LOOP);
                for( unsigned int p = 0; p < contour->PointCount(); ++p)
                {
                    glVertex2f( contour->Point(p).x / 64.0f, contour->Point(p).y / 64.0f);
                }
            glEnd();
        }
    glEndList();
}


Generated by  Doxygen 1.6.0   Back to index