Fixed the test for an invalid glyph format
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
diff --git a/src/FTBitmapGlyph.cpp b/src/FTBitmapGlyph.cpp
index 4663638..e2bc09b 100755
--- a/src/FTBitmapGlyph.cpp
+++ b/src/FTBitmapGlyph.cpp
@@ -10,12 +10,9 @@ FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph, unsigned int gi)
destHeight(0),
data(0)
{
- if( !glyph->format == ft_glyph_format_bitmap)
- { return;}
-
// This function will always fail if the glyph's format isn't scalable????
FT_Error err = FT_Glyph_To_Bitmap( &glyph, ft_render_mode_mono, 0, 1);
- if( err)
+ if( err || ft_glyph_format_bitmap != glyph->format)
{return;}
FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph;
diff --git a/src/FTPixmapGlyph.cpp b/src/FTPixmapGlyph.cpp
index 87b9750..7011e73 100755
--- a/src/FTPixmapGlyph.cpp
+++ b/src/FTPixmapGlyph.cpp
@@ -11,13 +11,10 @@ FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph, const unsigned int gi)
numGreys(0),
data(0)
{
- if( !glyph->format == ft_glyph_format_bitmap)
- { return;}
-
// This function will always fail if the glyph's format isn't scalable????
FT_Error err = FT_Glyph_To_Bitmap( &glyph, ft_render_mode_normal, 0, 1);
- if( err)
- {return;}
+ if( err || ft_glyph_format_bitmap != glyph->format)
+ { return;}
FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph;
FT_Bitmap* source = &bitmap->bitmap;
diff --git a/src/FTTextureGlyph.cpp b/src/FTTextureGlyph.cpp
index 965f1cf..7d81b38 100755
--- a/src/FTTextureGlyph.cpp
+++ b/src/FTTextureGlyph.cpp
@@ -13,13 +13,10 @@ FTTextureGlyph::FTTextureGlyph( FT_Glyph glyph, unsigned int gi, int id, unsigne
numGreys(0),
glTextureID(id)
{
- if( !glyph->format == ft_glyph_format_bitmap)
- { return;}
-
// This function will always fail if the glyph's format isn't scalable????
err = FT_Glyph_To_Bitmap( &glyph, ft_render_mode_normal, 0, 1);
- if( err)
- {return;}
+ if( err || glyph->format != ft_glyph_format_bitmap)
+ { return;}
FT_BitmapGlyph bitmap = ( FT_BitmapGlyph)glyph;
FT_Bitmap* source = &bitmap->bitmap;