FTGlyph.h

Go to the documentation of this file.
00001 #ifndef     __FTGlyph__
00002 #define     __FTGlyph__
00003 
00004 #include <ft2build.h>
00005 #include FT_FREETYPE_H
00006 #include FT_GLYPH_H
00007 
00008 #include "FTBBox.h"
00009 #include "FTPoint.h"
00010 #include "FTGL.h"
00011 
00012 
00013 /**
00014  * FTGlyph is the base class for FTGL glyphs.
00015  *
00016  * It provides the interface between Freetype glyphs and their openGL
00017  * renderable counterparts. This is an abstract class and derived classes
00018  * must implement the <code>render</code> function. 
00019  * 
00020  * @see FTGlyphContainer
00021  * @see FTBBox
00022  * @see FTPoint
00023  *
00024  */
00025 class FTGL_EXPORT FTGlyph
00026 {
00027     public:
00028         /**
00029          * Constructor
00030          *
00031          * @param glyph The Freetype glyph to be processed
00032          * @param useDisplayList Enable or disable the use of Display Lists for this glyph
00033          *                       <code>true</code> turns ON display lists.
00034          *                       <code>false</code> turns OFF display lists.
00035          */
00036         FTGlyph( FT_GlyphSlot glyph, bool useDisplayList = true);
00037 
00038         /**
00039          * Destructor
00040          */
00041         virtual ~FTGlyph();
00042 
00043         /**
00044          * Renders this glyph at the current pen position.
00045          *
00046          * @param pen   The current pen position.
00047          * @return      The advance distance for this glyph.
00048          */
00049         virtual const FTPoint& Render( const FTPoint& pen) = 0;
00050         
00051         /**
00052          * Return the advance width for this glyph.
00053          *
00054          * @return  advance width.
00055          */
00056         const FTPoint& Advance() const { return advance;}
00057         
00058         /**
00059          * Return the bounding box for this glyph.
00060          *
00061          * @return  bounding box.
00062          */
00063         const FTBBox& BBox() const { return bBox;}
00064         
00065         /**
00066          * Queries for errors.
00067          *
00068          * @return  The current error code.
00069          */
00070         FT_Error Error() const { return err;}
00071         
00072     protected:
00073         /**
00074          * The advance distance for this glyph
00075          */
00076         FTPoint advance;
00077 
00078         /**
00079          * The bounding box of this glyph.
00080          */
00081         FTBBox bBox;
00082         
00083         /**
00084          * Flag to enable or disable the use of Display Lists inside FTGL
00085          * <code>true</code> turns ON display lists.
00086          * <code>false</code> turns OFF display lists.
00087          */
00088         bool useDisplayList;
00089         
00090         /**
00091          * Current error code. Zero means no error.
00092          */
00093         FT_Error err;
00094         
00095     private:
00096 
00097 };
00098 
00099 
00100 #endif  //  __FTGlyph__
00101 

Generated on Tue Jul 5 14:16:15 2011 for ROOT_528-00b_version by  doxygen 1.5.1