<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>FTGL: FTOutlineGlyph.cpp Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.4 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <h1>FTOutlineGlyph.cpp</h1><a href="FTOutlineGlyph_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include "FTOutlineGlyph.h"</span> <a name="l00002"></a>00002 <span class="preprocessor">#include "FTVectoriser.h"</span> <a name="l00003"></a>00003 <a name="l00004"></a>00004 <a name="l00005"></a>00005 FTOutlineGlyph::FTOutlineGlyph( FT_GlyphSlot glyph, <span class="keywordtype">bool</span> useDisplayList) <a name="l00006"></a>00006 : FTGlyph( glyph), <a name="l00007"></a>00007 glList(0) <a name="l00008"></a>00008 { <a name="l00009"></a>00009 <span class="keywordflow">if</span>( ft_glyph_format_outline != glyph->format) <a name="l00010"></a>00010 { <a name="l00011"></a>00011 err = 0x14; <span class="comment">// Invalid_Outline</span> <a name="l00012"></a>00012 <span class="keywordflow">return</span>; <a name="l00013"></a>00013 } <a name="l00014"></a>00014 <a name="l00015"></a>00015 FTVectoriser vectoriser( glyph); <a name="l00016"></a>00016 <a name="l00017"></a>00017 <span class="keywordtype">size_t</span> numContours = vectoriser.ContourCount(); <a name="l00018"></a>00018 <span class="keywordflow">if</span> ( ( numContours < 1) || ( vectoriser.PointCount() < 3)) <a name="l00019"></a>00019 { <a name="l00020"></a>00020 <span class="keywordflow">return</span>; <a name="l00021"></a>00021 } <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="keywordflow">if</span>(useDisplayList) <a name="l00024"></a>00024 { <a name="l00025"></a>00025 glList = glGenLists(1); <a name="l00026"></a>00026 glNewList( glList, GL_COMPILE); <a name="l00027"></a>00027 } <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> c = 0; c < numContours; ++c) <a name="l00030"></a>00030 { <a name="l00031"></a>00031 <span class="keyword">const</span> FTContour* contour = vectoriser.Contour(c); <a name="l00032"></a>00032 <a name="l00033"></a>00033 glBegin( GL_LINE_LOOP); <a name="l00034"></a>00034 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pointIndex = 0; pointIndex < contour->PointCount(); ++pointIndex) <a name="l00035"></a>00035 { <a name="l00036"></a>00036 FTPoint point = contour->Point(pointIndex); <a name="l00037"></a>00037 glVertex2f( point.X() / 64.0f, point.Y() / 64.0f); <a name="l00038"></a>00038 } <a name="l00039"></a>00039 glEnd(); <a name="l00040"></a>00040 } <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="keywordflow">if</span>(useDisplayList) <a name="l00043"></a>00043 { <a name="l00044"></a>00044 glEndList(); <a name="l00045"></a>00045 } <a name="l00046"></a>00046 } <a name="l00047"></a>00047 <a name="l00048"></a>00048 <a name="l00049"></a>00049 FTOutlineGlyph::~FTOutlineGlyph() <a name="l00050"></a>00050 { <a name="l00051"></a>00051 glDeleteLists( glList, 1); <a name="l00052"></a>00052 } <a name="l00053"></a>00053 <a name="l00054"></a>00054 <a name="l00055"></a>00055 <span class="keyword">const</span> FTPoint& FTOutlineGlyph::Render( <span class="keyword">const</span> FTPoint& pen) <a name="l00056"></a>00056 { <a name="l00057"></a>00057 glTranslatef( pen.X(), pen.Y(), 0.0f); <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="keywordflow">if</span>( glList) <a name="l00060"></a>00060 { <a name="l00061"></a>00061 glCallList( glList); <a name="l00062"></a>00062 } <a name="l00063"></a>00063 <a name="l00064"></a>00064 <span class="keywordflow">return</span> advance; <a name="l00065"></a>00065 } <a name="l00066"></a>00066 </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Tue Dec 18 20:45:49 2007 for FTGL by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.4 </small></address> </body> </html>