Commit 8fd2ff3efc217129d17815a9ea8bca531ad6d92f

henry 2003-09-22T02:11:42

Fixes for deprecated identifiers in 2.1.5

diff --git a/include/FTGL.h b/include/FTGL.h
index e8de9a7..e92bd52 100755
--- a/include/FTGL.h
+++ b/include/FTGL.h
@@ -5,6 +5,20 @@
 typedef double   FTGL_DOUBLE;
 typedef float    FTGL_FLOAT;
 
+// Fixes for deprecated identifiers in 2.1.5
+#ifndef FT_OPEN_MEMORY
+    #define FT_OPEN_MEMORY (FT_Open_Flags)1
+#endif
+
+#ifndef FT_RENDER_MODE_MONO
+    #define FT_RENDER_MODE_MONO ft_render_mode_mono
+#endif
+
+#ifndef FT_RENDER_MODE_NORMAL
+    #define FT_RENDER_MODE_NORMAL ft_render_mode_normal
+#endif
+
+  
 #ifdef WIN32
 
     // Under windows avoid including <windows.h> is overrated. 
diff --git a/src/FTBitmapGlyph.cpp b/src/FTBitmapGlyph.cpp
index 9f48fb7..acfaa74 100755
--- a/src/FTBitmapGlyph.cpp
+++ b/src/FTBitmapGlyph.cpp
@@ -8,7 +8,7 @@ FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph)
     destHeight(0),
     data(0)
 {
-    err = FT_Glyph_To_Bitmap( &glyph, ft_render_mode_mono, 0, 1);
+    err = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_MONO, 0, 1);
     if( err || ft_glyph_format_bitmap != glyph->format)
     {
         return;
diff --git a/src/FTFace.cpp b/src/FTFace.cpp
index 874e43c..3d46a1f 100755
--- a/src/FTFace.cpp
+++ b/src/FTFace.cpp
@@ -58,10 +58,6 @@ bool FTFace::Attach( const char* filename)
 }
 
 
-#ifndef FT_OPEN_MEMORY
-    #define FT_OPEN_MEMORY (FT_Open_Flags)1
-#endif
-
 bool FTFace::Attach( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
 {
     FT_Open_Args open;
diff --git a/src/FTPixmapGlyph.cpp b/src/FTPixmapGlyph.cpp
index 9a60dbe..6f447e1 100755
--- a/src/FTPixmapGlyph.cpp
+++ b/src/FTPixmapGlyph.cpp
@@ -7,7 +7,7 @@ FTPixmapGlyph::FTPixmapGlyph( FT_Glyph glyph)
     data(0)
 {
     // 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);
+    err = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, 0, 1);
     if( err || ft_glyph_format_bitmap != glyph->format)
     {
         return;
diff --git a/src/FTTextureGlyph.cpp b/src/FTTextureGlyph.cpp
index 250249c..ac044a3 100755
--- a/src/FTTextureGlyph.cpp
+++ b/src/FTTextureGlyph.cpp
@@ -8,7 +8,7 @@ FTTextureGlyph::FTTextureGlyph( FT_Glyph glyph, int id, int xOffset, int yOffset
     glTextureID(id),
     activeTextureID(0)
 {
-    err = FT_Glyph_To_Bitmap( &glyph, ft_render_mode_normal, 0, 1);
+    err = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, 0, 1);
     if( err || glyph->format != ft_glyph_format_bitmap)
     {
         return;
diff --git a/test/FTVectoriser-Test.cpp b/test/FTVectoriser-Test.cpp
index f7fd404..7710d67 100755
--- a/test/FTVectoriser-Test.cpp
+++ b/test/FTVectoriser-Test.cpp
@@ -276,8 +276,8 @@ class FTVectoriserTest : public CppUnit::TestCase
         
         void testFreetypeVersion()
         {
-            setUpFreetype();
-            
+            setUpFreetype( NULL_CHARACTER_INDEX);
+
             FT_Int amajor;
             FT_Int aminor;
             FT_Int apatch;
@@ -303,8 +303,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         
         void testBadGlyphProcess()
         {
-            setUpFreetype();
-            loadGlyph( NULL_CHARACTER_INDEX);
+            setUpFreetype( NULL_CHARACTER_INDEX);
             
             FTVectoriser vectoriser( glyph);
             CPPUNIT_ASSERT( vectoriser.ContourCount() == 0);
@@ -315,8 +314,7 @@ class FTVectoriserTest : public CppUnit::TestCase
 
         void testSimpleGlyphProcess()
         {
-            setUpFreetype();
-            loadGlyph( SIMPLE_CHARACTER_INDEX);
+            setUpFreetype( SIMPLE_CHARACTER_INDEX);
             
             FTVectoriser vectoriser( glyph);
 
@@ -329,8 +327,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         
         void testComplexGlyphProcess()
         {
-            setUpFreetype();
-            loadGlyph( COMPLEX_CHARACTER_INDEX);
+            setUpFreetype( COMPLEX_CHARACTER_INDEX);
             
             FTVectoriser vectoriser( glyph);
 
@@ -343,8 +340,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         
         void testGetContour()
         {
-            setUpFreetype();
-            loadGlyph( SIMPLE_CHARACTER_INDEX);
+            setUpFreetype( SIMPLE_CHARACTER_INDEX);
             
             FTVectoriser vectoriser( glyph);
 
@@ -357,8 +353,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         
         void testGetOutline()
         {
-            setUpFreetype();
-            loadGlyph( COMPLEX_CHARACTER_INDEX);
+            setUpFreetype( COMPLEX_CHARACTER_INDEX);
             
             FTVectoriser vectoriser( glyph);
             
@@ -381,8 +376,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         
         void testGetMesh()
         {
-            setUpFreetype();
-            loadGlyph( SIMPLE_CHARACTER_INDEX);
+            setUpFreetype( SIMPLE_CHARACTER_INDEX);
             
             FTVectoriser vectoriser( glyph);
             CPPUNIT_ASSERT( vectoriser.GetMesh() == NULL);
@@ -395,8 +389,7 @@ class FTVectoriserTest : public CppUnit::TestCase
         
         void testMakeMesh()
         {
-            setUpFreetype();
-            loadGlyph( COMPLEX_CHARACTER_INDEX);
+            setUpFreetype( COMPLEX_CHARACTER_INDEX);
             
             FTVectoriser vectoriser( glyph);
 
@@ -441,13 +434,14 @@ class FTVectoriserTest : public CppUnit::TestCase
         FT_Face      face;
         FT_Glyph     glyph;
 
-        void setUpFreetype()
+        void setUpFreetype( unsigned int characterIndex)
         {
             FT_Error error = FT_Init_FreeType( &library);
             assert(!error);
             error = FT_New_Face( library, ARIAL_FONT_FILE, 0, &face);
             assert(!error);
             
+            loadGlyph( characterIndex);
         }
         
         void loadGlyph( unsigned int characterIndex)