Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

glt/fonttex.h

Go to the documentation of this file.
00001 #ifndef GLT_FONTTEX_H
00002 #define GLT_FONTTEX_H
00003 
00004 /*
00005 
00006   GLT OpenGL C++ Toolkit      
00007   Copyright (C) 2000-2002 Nigel Stewart
00008   Email: nigels.com@gmail.com   WWW: http://www.nigels.com/glt/
00009 
00010   This library is free software; you can redistribute it and/or
00011   modify it under the terms of the GNU Lesser General Public
00012   License as published by the Free Software Foundation; either
00013   version 2.1 of the License, or (at your option) any later version.
00014 
00015   This library is distributed in the hope that it will be useful,
00016   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018   Lesser General Public License for more details.
00019 
00020   You should have received a copy of the GNU Lesser General Public
00021   License along with this library; if not, write to the Free Software
00022   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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     // Convert between raw font data and a GLTF buffer
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;           // Ensure 32-bit alignment
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 //  int   _width;
00125 //  int   _height;
00126 //  int   _listBase;
00127 };
00128 
00129 #endif

Generated on Tue Nov 5 11:11:03 2002 for GLT by doxygen1.2.18