Added a check for a NULL glyph
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
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;
+ }
}
}