Commit e62d68b3e3b1f630c7cf376ca03de4f5613d3858

henry 2001-08-20T22:51:21

Started being more strict with types eg integer indices and sizes are now unsigned.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
diff --git a/include/FTBitmapGlyph.h b/include/FTBitmapGlyph.h
index 3c0a811..ca648b5 100755
--- a/include/FTBitmapGlyph.h
+++ b/include/FTBitmapGlyph.h
@@ -12,7 +12,7 @@ class	FTBitmapGlyph : public FTGlyph
 {
 	public:
 		// methods
-		FTBitmapGlyph( FT_Glyph glyph, int glyphIndex);
+		FTBitmapGlyph( FT_Glyph glyph, unsigned int glyphIndex);
 		virtual ~FTBitmapGlyph();
 		virtual float Render( const FT_Vector& v);
 		
diff --git a/include/FTFace.h b/include/FTFace.h
index c02bd29..6e347a6 100755
--- a/include/FTFace.h
+++ b/include/FTFace.h
@@ -20,10 +20,10 @@ class	FTFace
 		bool Open( const char* filename);
 		void Close();
 		
-		FTSize& Size( const int size, const int res);
+		FTSize& Size( const unsigned int size, const unsigned int res);
 		bool CharMap( FT_Encoding encoding);
-		int CharIndex( int index ) const;
-		FT_Vector& KernAdvance( int index1, int index2);
+		unsigned int CharIndex( unsigned int index ) const;
+		FT_Vector& KernAdvance( unsigned int index1, unsigned int index2);
 		
 		FT_Glyph& Glyph( unsigned int index, FT_Int load_flags);
 		FT_Face* Face() const { return ftFace;}
diff --git a/include/FTFont.h b/include/FTFont.h
index c2ab3e8..147f656 100755
--- a/include/FTFont.h
+++ b/include/FTFont.h
@@ -24,7 +24,7 @@ class	FTFont
 		virtual ~FTFont();
 		virtual bool Open( const char* fontname );
 		virtual void Close();
-		virtual bool FaceSize( const int size, const int res = 72 );
+		virtual bool FaceSize( const unsigned int size, const unsigned int res = 72 );
 		virtual bool CharMap( FT_Encoding encoding );
 		virtual int	Ascender() const;
 		virtual int	Descender() const;
diff --git a/include/FTGLTextureFont.h b/include/FTGLTextureFont.h
index 4057886..c221db0 100755
--- a/include/FTGLTextureFont.h
+++ b/include/FTGLTextureFont.h
@@ -34,16 +34,13 @@ class	FTGLTextureFont : public FTFont
 		int glyphHeight;
 		int glyphWidth;
 
-		int horizGlyphs;
-		int vertGlyphs;
-
 		int padding;
 		
 		// methods
 		bool MakeGlyphList();
 		void CreateTexture( int id, int width, int height, unsigned char* data);
 		void GetSize();
-		int FillGlyphs( int glyphStart, int textID, int textureWidth, int textureHeight, unsigned char* textMem);
+		unsigned int FillGlyphs( unsigned int glyphStart, int textID, int textureWidth, int textureHeight, unsigned char* textMem);
 		
 		
 };
diff --git a/include/FTGlyph.h b/include/FTGlyph.h
index b7d974d..7bcf4d9 100755
--- a/include/FTGlyph.h
+++ b/include/FTGlyph.h
@@ -12,14 +12,14 @@ class FTGlyph
 {
 	public:
 		// methods
-		FTGlyph( int glyphIndex);
+		FTGlyph( unsigned int glyphIndex);
 		virtual ~FTGlyph();
 		virtual float Render( const FT_Vector& v) = 0;
 		
 		FT_Error Error() const { return err;}
 		
 		// attributes
-		const int glyphIndex;
+		const unsigned int glyphIndex;
 		
 	protected:
 		// methods
diff --git a/include/FTGlyphContainer.h b/include/FTGlyphContainer.h
index b18c9f6..d09442a 100755
--- a/include/FTGlyphContainer.h
+++ b/include/FTGlyphContainer.h
@@ -22,7 +22,7 @@ class	FTGlyphContainer
 
 		bool Add( FTGlyph* tempGlyph);
 
-		FT_Vector& render( int index, int next, FT_Vector pen);
+		FT_Vector& render( unsigned int index, unsigned int next, FT_Vector pen);
 		
 		// attributes
 		
diff --git a/include/FTPixmapGlyph.h b/include/FTPixmapGlyph.h
index d014ca1..abdaf48 100755
--- a/include/FTPixmapGlyph.h
+++ b/include/FTPixmapGlyph.h
@@ -12,7 +12,7 @@ class FTPixmapGlyph : public FTGlyph
 {
 	public:
 		// methods
-		FTPixmapGlyph( FT_Glyph glyph, const int glyphIndex);
+		FTPixmapGlyph( FT_Glyph glyph, const unsigned int glyphIndex);
 		virtual ~FTPixmapGlyph();
 		virtual float Render( const FT_Vector& v);
 		
diff --git a/include/FTPolyGlyph.h b/include/FTPolyGlyph.h
index 36f951a..a692b63 100644
--- a/include/FTPolyGlyph.h
+++ b/include/FTPolyGlyph.h
@@ -13,7 +13,7 @@ class	FTPolyGlyph : public FTGlyph
 {
 	public:
 		// methods
-		FTPolyGlyph( FT_Glyph glyph, int glyphIndex);
+		FTPolyGlyph( FT_Glyph glyph, unsigned int glyphIndex);
 		virtual ~FTPolyGlyph();
 		virtual float Render( const FT_Vector& pen);
 		
diff --git a/include/FTSize.h b/include/FTSize.h
index e3dd319..fd15667 100755
--- a/include/FTSize.h
+++ b/include/FTSize.h
@@ -13,7 +13,7 @@ class	FTSize
 		// methods
 		FTSize();
 		virtual ~FTSize();
-		bool CharSize( FT_Face* face, int point_size, int x_resolution, int y_resolution );
+		bool CharSize( FT_Face* face, unsigned int point_size, unsigned int x_resolution, unsigned int y_resolution );
 		float Ascender() const;
 		float Descender() const;
 		float Height() const;
@@ -29,8 +29,8 @@ class	FTSize
 		
 		// attributes
 		FT_Face* ftFace;
-		FT_Size   ftSize;
-		int	size;
+		FT_Size ftSize;
+		unsigned int size;
 		
 		FT_Error err;
 		
diff --git a/include/FTTextureGlyph.h b/include/FTTextureGlyph.h
index 349737c..871dcd9 100755
--- a/include/FTTextureGlyph.h
+++ b/include/FTTextureGlyph.h
@@ -1,18 +1,19 @@
 #ifndef		__FTTextureGlyph__
 #define		__FTTextureGlyph__
 
+
 #include <ft2build.h>
 #include FT_FREETYPE_H
 #include FT_GLYPH_H
 
-#include	"FTGlyph.h"
+#include "FTGlyph.h"
 
 
 class	FTTextureGlyph : public FTGlyph
 {
 	public:
 		// methods
-		FTTextureGlyph( FT_Glyph glyph, int gi, int id, unsigned char* data, int stride, int height, float u, float v);
+		FTTextureGlyph( FT_Glyph glyph, unsigned int gi, int id, unsigned char* data, int stride, int height, float u, float v);
 		virtual ~FTTextureGlyph();
 		virtual float Render( const FT_Vector& v);
 		
diff --git a/src/FTBitmapGlyph.cpp b/src/FTBitmapGlyph.cpp
index 5404b43..1f032e4 100755
--- a/src/FTBitmapGlyph.cpp
+++ b/src/FTBitmapGlyph.cpp
@@ -4,7 +4,7 @@
 #include	"FTGL.h"
 
 
-FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph, int gi)
+FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph, unsigned int gi)
 :	FTGlyph( gi),
 	destWidth(0),
 	destHeight(0),
diff --git a/src/FTFace.cpp b/src/FTFace.cpp
index 3502b48..49a2d3a 100755
--- a/src/FTFace.cpp
+++ b/src/FTFace.cpp
@@ -45,7 +45,7 @@ void FTFace::Close()
 }
 
 
-FTSize& FTFace::Size( const int size, const int res )
+FTSize& FTFace::Size( const unsigned int size, const unsigned int res )
 {
 	charSize.CharSize( ftFace, size, res, res);
 	return charSize;
@@ -73,13 +73,13 @@ bool FTFace::CharMap( FT_Encoding encoding )
 }
 
 
-int FTFace::CharIndex( int index ) const
+int FTFace::CharIndex( unsigned int index ) const
 {
 	return FT_Get_Char_Index( *ftFace, index);
 }
 
 
-FT_Vector& FTFace::KernAdvance( int index1, int index2 )
+FT_Vector& FTFace::KernAdvance( unsigned int index1, unsigned int index2 )
 {
 	kernAdvance.x = 0; kernAdvance.y = 0;
 	
diff --git a/src/FTFont.cpp b/src/FTFont.cpp
index 00067a2..f48fffc 100755
--- a/src/FTFont.cpp
+++ b/src/FTFont.cpp
@@ -44,7 +44,7 @@ void FTFont::Close()
 }
 
 
-bool FTFont::FaceSize( const int size, const int res )
+bool FTFont::FaceSize( const unsigned int size, const unsigned int res )
 {
 	charSize = face.Size( size, res);
 
diff --git a/src/FTGLBitmapFont.cpp b/src/FTGLBitmapFont.cpp
index 68210a3..3992d34 100755
--- a/src/FTGLBitmapFont.cpp
+++ b/src/FTGLBitmapFont.cpp
@@ -23,7 +23,7 @@ bool FTGLBitmapFont::MakeGlyphList()
 	
 //	numGlyphs = 256; // FIXME hack
 	
-	for( int c = 0; c < numGlyphs; ++c)
+	for( unsigned int c = 0; c < numGlyphs; ++c)
 	{
 		err = FT_Load_Glyph( *ftFace, c, FT_LOAD_DEFAULT);
 		FT_Glyph ftGlyph;
diff --git a/src/FTGLOutlineFont.cpp b/src/FTGLOutlineFont.cpp
index 736ebcb..78d70da 100755
--- a/src/FTGLOutlineFont.cpp
+++ b/src/FTGLOutlineFont.cpp
@@ -22,7 +22,7 @@ bool FTGLOutlineFont::MakeGlyphList()
 	
 	numGlyphs = 127; // FIXME hack
 	
-	for( int n = 0; n < numGlyphs; ++n)
+	for( unsigned int n = 0; n < numGlyphs; ++n)
 	{
 		err = FT_Load_Glyph( *ftFace, n, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP); // FT_LOAD_DEFAULT... FT_LOAD_NO_SCALE
 		FT_Glyph ftGlyph;
diff --git a/src/FTGLPixmapFont.cpp b/src/FTGLPixmapFont.cpp
index 8364304..682772c 100755
--- a/src/FTGLPixmapFont.cpp
+++ b/src/FTGLPixmapFont.cpp
@@ -22,7 +22,7 @@ bool FTGLPixmapFont::MakeGlyphList()
 	
 //	numGlyphs = 256; // FIXME hack
 	
-	for( int c = 0; c < numGlyphs; ++c)
+	for( unsigned int c = 0; c < numGlyphs; ++c)
 	{
 		err = FT_Load_Glyph( *ftFace, c, FT_LOAD_DEFAULT);
 		FT_Glyph ftGlyph;
diff --git a/src/FTGLPolygonFont.cpp b/src/FTGLPolygonFont.cpp
index 89bdcba..8661ffe 100755
--- a/src/FTGLPolygonFont.cpp
+++ b/src/FTGLPolygonFont.cpp
@@ -20,7 +20,7 @@ bool FTGLPolygonFont::MakeGlyphList()
 	
 	numGlyphs = 127; // FIXME hack
 	
-	for( int n = 0; n < numGlyphs; ++n)
+	for( unsigned int n = 0; n < numGlyphs; ++n)
 	{
 		err = FT_Load_Glyph( *ftFace, n, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP); // FT_LOAD_DEFAULT... FT_LOAD_NO_SCALE
 		FT_Glyph ftGlyph;
diff --git a/src/FTGLTextureFont.cpp b/src/FTGLTextureFont.cpp
index 902d79c..7b5bc93 100755
--- a/src/FTGLTextureFont.cpp
+++ b/src/FTGLTextureFont.cpp
@@ -67,7 +67,7 @@ bool FTGLTextureFont::MakeGlyphList()
 		textMem = new unsigned char[totalMem]; // GL_ALPHA texture;
 		std::memset( textMem, 0, totalMem);
 			
-		int glyphNum = 0;
+		unsigned int glyphNum = 0;
 		unsigned char* currTextPtr = textMem;
 		
 		for( int x = 0; x < numTextures - 1; ++x)
@@ -102,7 +102,7 @@ bool FTGLTextureFont::MakeGlyphList()
 }
 
 
-int FTGLTextureFont::FillGlyphs( int glyphStart, int id, int width, int height, unsigned char* textdata)
+unsigned int FTGLTextureFont::FillGlyphs( unsigned int glyphStart, int id, int width, int height, unsigned char* textdata)
 {
 	FT_Face* ftFace = face.Face();
 	
@@ -113,7 +113,7 @@ int FTGLTextureFont::FillGlyphs( int glyphStart, int id, int width, int height, 
 	float currTextV = (float)padding / (float)height;
 	
 //	numGlyphs = 256; // FIXME hack
-	int n;
+	unsigned int n;
 	
 	for( n = glyphStart; n <= numGlyphs; ++n)
 	{
@@ -179,7 +179,7 @@ void FTGLTextureFont::render( const char* string)
 	glEnable(GL_BLEND);
  	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
  	
-	glBindTexture( GL_TEXTURE_2D, FTTextureGlyph::activeTextureID);
+	glBindTexture( GL_TEXTURE_2D, (GLuint)FTTextureGlyph::activeTextureID);
 
  	// QUADS are faster!? Less function call overhead?
  	glBegin( GL_QUADS);
diff --git a/src/FTGlyph.cpp b/src/FTGlyph.cpp
index c83ef4e..c4335ab 100755
--- a/src/FTGlyph.cpp
+++ b/src/FTGlyph.cpp
@@ -2,7 +2,7 @@
 
 
 // OPSignature:  FTGlyph:FTGlyph( FT_Face:face  int:glyphIndex ) 
-FTGlyph::FTGlyph( int gi)
+FTGlyph::FTGlyph( unsigned int gi)
 :	advance(0),
 	glyphIndex(gi),
 	ftGlyph(0),
diff --git a/src/FTGlyphContainer.cpp b/src/FTGlyphContainer.cpp
index 7f00e44..71075a4 100755
--- a/src/FTGlyphContainer.cpp
+++ b/src/FTGlyphContainer.cpp
@@ -33,12 +33,12 @@ bool FTGlyphContainer::Add( FTGlyph* tempGlyph)
 }
 
 
-FT_Vector& FTGlyphContainer::render( int index, int next, FT_Vector pen)
+FT_Vector& FTGlyphContainer::render( unsigned int index, unsigned int next, FT_Vector pen)
 {
 	kernAdvance.x = 0; kernAdvance.y = 0;
 	
-	int left = face->CharIndex( index);
-	int right = face->CharIndex( next);
+	unsigned int left = face->CharIndex( index);
+	unsigned int right = face->CharIndex( next);
 	
 	kernAdvance = face->KernAdvance( left, right);	
 	if( !face->Error())
diff --git a/src/FTPixmapGlyph.cpp b/src/FTPixmapGlyph.cpp
index a4c0439..ed83952 100755
--- a/src/FTPixmapGlyph.cpp
+++ b/src/FTPixmapGlyph.cpp
@@ -4,7 +4,7 @@
 #include	"FTGL.h"
 
 
-FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph, const int gi)
+FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph, const unsigned int gi)
 :	FTGlyph(gi),
 	destWidth(0),
 	destHeight(0),
@@ -78,14 +78,14 @@ float FTPixmapGlyph::Render( const FT_Vector& pen)
 		glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT);
 		
 		// Move the glyph origin
-		glBitmap( 0, 0, 0.0, 0.0, pen.x + pos.x, pen.y - pos.y, (const GLubyte *)0 );
+		glBitmap( 0, 0, 0.0, 0.0, pen.x + pos.x, pen.y - pos.y, (const GLubyte *)0);
 
 		glPixelStorei( GL_UNPACK_ROW_LENGTH, destWidth);
 
-		glDrawPixels( destWidth, destHeight, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid*)data );
+		glDrawPixels( destWidth, destHeight, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid*)data);
 
 		// Restore the glyph origin
-		glBitmap( 0, 0, 0.0, 0.0, -pen.x - pos.x, -pen.y + pos.y, (const GLubyte *)0 );
+		glBitmap( 0, 0, 0.0, 0.0, -pen.x - pos.x, -pen.y + pos.y, (const GLubyte *)0);
 
 		glPopClientAttrib();
 	}
diff --git a/src/FTPolyGlyph.cpp b/src/FTPolyGlyph.cpp
index 0882528..0c24b9e 100644
--- a/src/FTPolyGlyph.cpp
+++ b/src/FTPolyGlyph.cpp
@@ -49,7 +49,7 @@ void ftglCombine( GLdouble coords[3], void* vertex_data[4], GLfloat weight[4], v
 }
 
 
-FTPolyGlyph::FTPolyGlyph( FT_Glyph glyph, int gi)
+FTPolyGlyph::FTPolyGlyph( FT_Glyph glyph, unsigned int gi)
 :	FTGlyph(gi),
 	vectoriser(0),
 	numPoints(0),
diff --git a/src/FTSize.cpp b/src/FTSize.cpp
index 41e4dbe..532f133 100755
--- a/src/FTSize.cpp
+++ b/src/FTSize.cpp
@@ -11,7 +11,7 @@ FTSize::~FTSize()
 {}
 
 
-bool	FTSize::CharSize( FT_Face* ftFace, int point_size, int x_resolution, int y_resolution )
+bool FTSize::CharSize( FT_Face* ftFace, unsigned int point_size, unsigned int x_resolution, unsigned int y_resolution )
 {
 	this->ftFace = ftFace;
 	size = point_size;
diff --git a/src/FTTextureGlyph.cpp b/src/FTTextureGlyph.cpp
index 9ad2d76..d3d29af 100755
--- a/src/FTTextureGlyph.cpp
+++ b/src/FTTextureGlyph.cpp
@@ -6,7 +6,7 @@
 
 int FTTextureGlyph::activeTextureID = 0;
 
-FTTextureGlyph::FTTextureGlyph( FT_Glyph glyph, int gi, int id, unsigned char* data, int stride, int height, float u, float v)
+FTTextureGlyph::FTTextureGlyph( FT_Glyph glyph, unsigned int gi, int id, unsigned char* data, int stride, int height, float u, float v)
 :	FTGlyph(gi),
 	destWidth(0),
 	destHeight(0),
@@ -81,7 +81,7 @@ float FTTextureGlyph::Render( const FT_Vector& pen)
 	if( activeTextureID != glTextureID)
 	{
 		glEnd();
-		glBindTexture( GL_TEXTURE_2D, glTextureID);
+		glBindTexture( GL_TEXTURE_2D, (GLuint)glTextureID);
 		activeTextureID = glTextureID;
 		glBegin( GL_QUADS);
 	}
diff --git a/src/FTVectorGlyph.cpp b/src/FTVectorGlyph.cpp
index da2f92f..d306306 100755
--- a/src/FTVectorGlyph.cpp
+++ b/src/FTVectorGlyph.cpp
@@ -6,7 +6,7 @@
 
 
 
-FTVectorGlyph::FTVectorGlyph( FT_Glyph glyph, int gi)
+FTVectorGlyph::FTVectorGlyph( FT_Glyph glyph, unsigned int gi)
 :	FTGlyph(gi),
 	vectoriser(0),
 	numPoints(0),
diff --git a/src/FTVectorGlyph.h b/src/FTVectorGlyph.h
index 3c47435..ac4e436 100755
--- a/src/FTVectorGlyph.h
+++ b/src/FTVectorGlyph.h
@@ -13,7 +13,7 @@ class	FTVectorGlyph : public FTGlyph
 {
 	public:
 		// methods
-		FTVectorGlyph( FT_Glyph glyph, int glyphIndex);
+		FTVectorGlyph( FT_Glyph glyph, unsigned int glyphIndex);
 		virtual ~FTVectorGlyph();
 		virtual float Render( const FT_Vector& pen);