Back to index

extremetuxracer  0.5beta
FTFont.h
Go to the documentation of this file.
00001 #ifndef    __FTFont__
00002 #define    __FTFont__
00003 
00004 #include <ft2build.h>
00005 #include FT_FREETYPE_H
00006 
00007 #include "FTFace.h"
00008 #include "FTGL.h"
00009 
00010 class FTGlyphContainer;
00011 class FTGlyph;
00012 
00013 
00032 class FTGL_EXPORT FTFont
00033 {
00034     public:
00040         FTFont( const char* fontFilePath);
00041         
00050         FTFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
00051         
00055         virtual ~FTFont();
00056         
00066         bool Attach( const char* fontFilePath);
00067 
00078         bool Attach( const unsigned char *pBufferBytes, size_t bufferSizeInBytes);
00079 
00087         bool CharMap( FT_Encoding encoding );
00088 
00094         unsigned int CharMapCount();
00095 
00101         FT_Encoding* CharMapList();
00102         
00110         virtual bool FaceSize( const unsigned int size, const unsigned int res = 72);
00111         
00117         unsigned int FaceSize() const;
00118         
00125         virtual void Depth( float depth){}
00126 
00133         void UseDisplayList( bool useList);
00134         
00140         float Ascender() const;
00141         
00147         float Descender() const;
00148         
00154         float LineHeight() const;
00155         
00167         void BBox( const char* string, float& llx, float& lly, float& llz, float& urx, float& ury, float& urz);
00168 
00180         void BBox( const wchar_t* string, float& llx, float& lly, float& llz, float& urx, float& ury, float& urz);
00181 
00188         float Advance( const wchar_t* string);
00189 
00196         float Advance( const char* string);
00197 
00203         virtual void Render( const char* string );
00204 
00210         virtual void Render( const wchar_t* string );
00211 
00217         FT_Error Error() const { return err;}
00218 
00219     protected:
00229         virtual FTGlyph* MakeGlyph( unsigned int g) = 0;
00230         
00234         FTFace face;
00235         
00239         FTSize charSize;
00240 
00246         bool useDisplayLists;
00247 
00251         FT_Error err;
00252         
00253     private:        
00260         inline bool CheckGlyph( const unsigned int chr);
00261 
00265         FTGlyphContainer* glyphList;
00266         
00270         FTPoint pen;
00271         
00272 };
00273 
00274 
00275 #endif  //  __FTFont__
00276