Commit c31d4c660169f38669e52b1c4f96bab4599d4041

henry 2001-08-27T21:40:22

Added a check for a NULL glyph

diff --git a/src/FTGLBitmapFont.cpp b/src/FTGLBitmapFont.cpp
index 53d3cca..0997433 100755
--- a/src/FTGLBitmapFont.cpp
+++ b/src/FTGLBitmapFont.cpp
@@ -23,8 +23,11 @@ bool FTGLBitmapFont::MakeGlyphList()
 		FT_Glyph* ftGlyph = face.Glyph( c, FT_LOAD_DEFAULT);
 //		FT_HAS_VERTICAL(face)
 
-		tempGlyph = new FTBitmapGlyph( *ftGlyph, c);
-		glyphList->Add( tempGlyph);
+		if( ftGlyph)
+		{
+			tempGlyph = new FTBitmapGlyph( *ftGlyph, c);
+			glyphList->Add( tempGlyph);
+		}
 	}
 	
 	return !err;
diff --git a/src/FTGLOutlineFont.cpp b/src/FTGLOutlineFont.cpp
index 8466e43..0dccc64 100755
--- a/src/FTGLOutlineFont.cpp
+++ b/src/FTGLOutlineFont.cpp
@@ -21,8 +21,11 @@ bool FTGLOutlineFont::MakeGlyphList()
 	{
 		FT_Glyph* ftGlyph = face.Glyph( n, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
 		
-		tempGlyph = new FTVectorGlyph( *ftGlyph, n);
-		glyphList->Add( tempGlyph);
+		if( ftGlyph)
+		{
+			tempGlyph = new FTVectorGlyph( *ftGlyph, n);
+			glyphList->Add( tempGlyph);
+		}
 	}
 	
 	return !err;
diff --git a/src/FTGLPixmapFont.cpp b/src/FTGLPixmapFont.cpp
index 19aa5de..b27184f 100755
--- a/src/FTGLPixmapFont.cpp
+++ b/src/FTGLPixmapFont.cpp
@@ -22,9 +22,12 @@ bool FTGLPixmapFont::MakeGlyphList()
 	{
 		FT_Glyph* ftGlyph = face.Glyph( c, FT_LOAD_DEFAULT);
 //		FT_HAS_VERTICAL(face)
-
-		tempGlyph = new FTPixmapGlyph( *ftGlyph, c);
-		glyphList->Add( tempGlyph);
+	
+		if( ftGlyph)
+		{
+			tempGlyph = new FTPixmapGlyph( *ftGlyph, c);
+			glyphList->Add( tempGlyph);
+		}
 	}
 	
 	return !err;
diff --git a/src/FTGLPolygonFont.cpp b/src/FTGLPolygonFont.cpp
index 54df152..073e505 100755
--- a/src/FTGLPolygonFont.cpp
+++ b/src/FTGLPolygonFont.cpp
@@ -20,8 +20,11 @@ bool FTGLPolygonFont::MakeGlyphList()
 	{
 		FT_Glyph* ftGlyph = face.Glyph( n, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
 		
-		tempGlyph = new FTPolyGlyph( *ftGlyph, n);
-		glyphList->Add( tempGlyph);
+		if( ftGlyph)
+		{
+			tempGlyph = new FTPolyGlyph( *ftGlyph, n);
+			glyphList->Add( tempGlyph);
+		}
 	}
 	
 	return !err;
diff --git a/src/FTGLTextureFont.cpp b/src/FTGLTextureFont.cpp
index d191db1..b44a908 100755
--- a/src/FTGLTextureFont.cpp
+++ b/src/FTGLTextureFont.cpp
@@ -117,22 +117,25 @@ unsigned int FTGLTextureFont::FillGlyphs( unsigned int glyphStart, int id, int w
 	{
 		FT_Glyph* ftGlyph = face.Glyph( n, FT_LOAD_NO_HINTING);
 		
-		unsigned char* data = textdata + (( currentTextY * width) + currentTextX);
-		
-		currTextU = (float)currentTextX / (float)width;
-		
-		tempGlyph = new FTTextureGlyph( *ftGlyph, n, id, data, width, height, currTextU, currTextV);
-		glyphList->Add( tempGlyph);
-		
-		currentTextX += glyphWidth;
-		if( currentTextX > ( width - glyphWidth))
+		if( ftGlyph)
 		{
-			currentTextY += glyphHeight;
-			if( currentTextY > ( height - glyphHeight))
-				return n;
-				
-			currentTextX = padding;
-			currTextV = (float)currentTextY / (float)height;
+			unsigned char* data = textdata + (( currentTextY * width) + currentTextX);
+			
+			currTextU = (float)currentTextX / (float)width;
+			
+			tempGlyph = new FTTextureGlyph( *ftGlyph, n, id, data, width, height, currTextU, currTextV);
+			glyphList->Add( tempGlyph);
+			
+			currentTextX += glyphWidth;
+			if( currentTextX > ( width - glyphWidth))
+			{
+				currentTextY += glyphHeight;
+				if( currentTextY > ( height - glyphHeight))
+					return n;
+					
+				currentTextX = padding;
+				currTextV = (float)currentTextY / (float)height;
+			}
 		}
 	}