00001 #ifndef GLT_FONTTEX_H
00002 #define GLT_FONTTEX_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00038 #include <glt/config.h>
00039
00040 #include <glt/font.h>
00041 #include <glt/texture.h>
00042
00053 class GltFontTexture : public GltFont
00054 {
00055 public:
00057 GltFontTexture(void *data = NULL);
00059 ~GltFontTexture();
00060
00061 void init(void *);
00062 void clear();
00063
00064 bool print(const wchar_t ch) const;
00065 bool print(const std::wstring &str) const;
00066 int width(const wchar_t ch) const;
00067
00068
00069
00070
00071
00072 static bool makeHeader(std::string &header,const int width,const int height);
00073 static void *getHeader(const void * const h,int &width,int &height);
00074
00075 private:
00076
00077 typedef struct
00078 {
00079 uint16 glyph;
00080 byte width;
00081 byte height;
00082 char xoffset;
00083 char yoffset;
00084 char advance;
00085 char dummy;
00086 int16 x;
00087 int16 y;
00088 }
00089 GlyphInfo;
00090
00091 typedef struct
00092 {
00093 GLfloat t0[2];
00094 GLshort v0[2];
00095 GLfloat t1[2];
00096 GLshort v1[2];
00097 GLfloat t2[2];
00098 GLshort v2[2];
00099 GLfloat t3[2];
00100 GLshort v3[2];
00101 byte width;
00102 GLfloat advance;
00103 }
00104 GlyphVertexInfo;
00105
00106
00107
00108 bool print(const char ch) const;
00109 bool print(const std::string &str) const;
00110
00111 void compileLists(void *);
00112
00113 GltTexture _texture;
00114 int32 _maxAscent;
00115 int32 _maxDescent;
00116 int32 _numGlyphs;
00117 int32 _minGlyph;
00118 int32 _range;
00119
00120 GlyphInfo *_glyph;
00121 GlyphVertexInfo *_glyphVertex;
00122 GlyphVertexInfo **_glyphLut;
00123
00124
00125
00126
00127 };
00128
00129 #endif