]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Reve/GLTextNS.h
Dummy methods DefineParticle required by the interface added.
[u/mrichter/AliRoot.git] / EVE / Reve / GLTextNS.h
1
2 #ifndef Reve_GLTextNS_H
3 #define Reve_GLTextNS_H
4
5 // The following implementation is based on TexFont API,
6 // implementation and accompanying programs by Mark J. Kilgard.
7 // Original license:
8
9 /* Copyright (c) Mark J. Kilgard, 1997. */
10 /* This program is freely distributable without licensing fees  and is
11    provided without guarantee or warrantee expressed or implied. This
12    program is -not- in the public domain. */
13
14 #ifndef __CINT__
15
16 #include <TObject.h>
17 #include <TGLIncludes.h>
18
19 class TString;
20
21 namespace GLTextNS {
22
23 #define TXF_FORMAT_BYTE         0
24 #define TXF_FORMAT_BITMAP       1
25
26 struct TexGlyphInfo {
27   unsigned short c;       /* Potentially support 16-bit glyphs. */
28   unsigned char width;
29   unsigned char height;
30   signed char xoffset;
31   signed char yoffset;
32   signed char advance;
33   char dummy;           /* Space holder for alignment reasons. */
34   short x;
35   short y;
36 };
37
38 struct TexGlyphVertexInfo {
39   GLfloat t0[2];
40   GLshort v0[2];
41   GLfloat t1[2];
42   GLshort v1[2];
43   GLfloat t2[2];
44   GLshort v2[2];
45   GLfloat t3[2];
46   GLshort v3[2];
47   GLfloat advance;
48 };
49
50 class TexFont : public TObject {
51 public:
52   GLuint texobj;
53   int tex_width;
54   int tex_height;
55   int max_ascent;
56   int max_descent;
57   int max_width;   // max glyph width (MT)
58   int num_glyphs;
59   int min_glyph;
60   int range;
61   unsigned char *teximage;
62   TexGlyphInfo *tgi;
63   TexGlyphVertexInfo *tgvi;
64   TexGlyphVertexInfo **lut;
65
66   int max_height() { return max_ascent + max_descent; }
67 };
68
69
70 extern char *txfErrorString(void);
71
72 extern TexFont *txfLoadFont(const char *filename);
73
74 extern void txfUnloadFont(TexFont* txf);
75
76 extern GLuint txfEstablishTexture(TexFont* txf, GLuint texobj,
77                                   GLboolean setupMipmaps);
78
79 extern void txfBindFontTexture(TexFont* txf);
80
81 extern void txfGetStringMetrics(TexFont* txf, const char *TString, int len,
82                                 int &width, int &max_ascent, int &max_descent);
83
84 extern void txfRenderGlyph(TexFont* txf, int c);
85 extern void txfRenderString(TexFont* txf, const char *TString, int len,
86                             bool keep_pos=true);
87 extern void txfRenderString(TexFont* txf, const char *TString, int len,
88                             GLfloat maxx, GLfloat fadew,
89                             bool keep_pos=true);
90
91 extern void txfRenderGlyphZW(TexFont* txf, int c, float z, float w);
92 extern void txfRenderStringZW(TexFont* txf, const char *TString, int len,
93                               float z, float w, bool keep_pos=true);
94
95 extern void txfRenderFancyString(TexFont* txf, char *TString, int len);
96
97
98 bool        LoadDefaultFont(TString font_file);
99
100 extern TexFont* fgDefaultFont; 
101
102 /**************************************************************************/
103 // Here starts MT higher-level interface
104 /**************************************************************************/
105 /*
106   struct BoxSpecs {
107   int     lm, rm, tm, bm;
108   int     lineskip;
109   char    align;
110   TString pos;
111
112   void _init() { align = 'l'; lineskip = 0; }
113
114   BoxSpecs()
115   { lm = rm = 3; tm = 0; bm = 2; _init(); }
116
117   BoxSpecs(int lr, int tb)
118   { lm = rm = lr; tm = bm = tb; _init(); }
119
120   BoxSpecs(int l, int r, int t, int b)
121   { lm = l; rm = r; tm = t; bm = b; _init(); }
122   };
123   struct TextLineData {
124   int    width, ascent, descent, hfull;
125   TString text;
126
127   TextLineData(TexFont *txf, TString line);
128   };
129
130   extern void RnrTextBar(RnrDriver* rd, const TString& text);
131
132   extern void RnrTextBar(RnrDriver* rd, const TString& text,
133   BoxSpecs& bs, float zoffset=0);
134
135   extern void RnrTextPoly(RnrDriver* rd, const TString& text);
136
137   extern void RnrText(RnrDriver* rd, const TString& text,
138   int x, int y, float z,
139   const ZColor* front_col, const ZColor* back_col=0);
140
141   extern void RnrTextAt(RnrDriver* rd, const TString& text,
142   int x, int yrow, float z,
143   const ZColor* front_col, const ZColor* back_col=0);
144 */
145
146 }  // namescape GLTextNS
147
148 #endif  // cint
149 #endif  // Reve_GLTextNS_H