00001 /*
00002 File: FTRenderer.h
00003
00004 Function:
00005
00006 Author: Andrew Willmott
00007
00008 Copyright: (c) 1999-2000, Andrew Willmott
00009 */
00010
00011 #ifndef __FTRenderer__
00012 #define __FTRenderer__
00013
00014 #include "gcl/Image.h"
00015 #include <freetype.h>
00016
00017 class FTRenderer
00018 {
00019 public:
00020 FTRenderer();
00021 ~FTRenderer();
00022
00023 Void RenderText(StrConst txt);
00024 Void SetFace(StrConst filename);
00025 Void SetPointSize(Int size);
00026
00027 // internal
00028 Void Init();
00029 Void Free();
00030 Void LoadGlyphs(StrConst txt, Int txtlen);
00031 Void RenderAllGlyphs(StrConst txt, Int txtlen);
00032
00033 Void SetupGlyphTable();
00034 Void FreeGlyphTable();
00035 Void FreeFace();
00036
00037 Void RenderGlyph(TT_Glyph glyph,
00038 TT_F26Dot6 x_off, TT_F26Dot6 y_off,
00039 TT_Glyph_Metrics *gmetrics
00040 );
00041
00042 Void SetupImage(StrConst txt, Int txtlen);
00043
00044 Int dpi;
00045 Int pointSize;
00046 Int hinted;
00047 Int smooth;
00048 Int border;
00049
00050 TT_Engine engine;
00051 TT_Face face;
00052 Bool faceSet;
00053 TT_Instance instance;
00054 TT_Raster_Map pixmap;
00055
00056 // Glyph table
00057 TT_Glyph *glyphs;
00058 Int numGlyphs;
00059 Bool noCharMap;
00060 TT_CharMap charMap;
00061
00062 Int xShift, yShift;
00063 ByteImage image;
00064 };
00065
00066 #endif