Commit 5dfbdf76594325baea09634869566195cf5937e8

Werner Lemberg 2002-09-16T06:15:31

Making ftgrays.c compile stand-alone again. * include/freetype/ftimage.h: Include ft2build.h only if _STANDALONE_ isn't defined. * src/smooth/ftgrays.c [_STANDALONE_]: Define ft_memset, FT_BEGIN_HEADER, FT_END_HEADER. (FT_MEM_ZERO): Define. (TRaster) [GRAYS_USE_GAMMA]: Use `unsigned char' instead of FT_Byte. (gray_render_span, gray_init_gamma): Don't use `FT_UInt'. Don't cast with `FT_Byte'. (grays_init_gamma): Don't use `FT_UInt'. * src/base/ftinit.c (FT_Add_Default_Modules): Improve error message. * src/pcf/pcfdriver.c (PCF_Face_Done): Improve tracing message. * include/freetype/config/ftoption.h (FT_MAX_MODULES): Increased to 32.

diff --git a/ChangeLog b/ChangeLog
index acee223..a858f24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2002-09-14  Werner Lemberg  <wl@gnu.org>
+
+	Making ftgrays.c compile stand-alone again.
+
+	* include/freetype/ftimage.h: Include ft2build.h only if _STANDALONE_
+	isn't defined.
+	* src/smooth/ftgrays.c [_STANDALONE_]: Define ft_memset,
+	FT_BEGIN_HEADER, FT_END_HEADER.
+	(FT_MEM_ZERO): Define.
+	(TRaster) [GRAYS_USE_GAMMA]: Use `unsigned char' instead of FT_Byte.
+	(gray_render_span, gray_init_gamma): Don't use `FT_UInt'.
+	Don't cast with `FT_Byte'.
+	(grays_init_gamma): Don't use `FT_UInt'.
+
+2002-09-14  Werner Lemberg  <wl@gnu.org>
+
+	* src/base/ftinit.c (FT_Add_Default_Modules): Improve error message.
+	* src/pcf/pcfdriver.c (PCF_Face_Done): Improve tracing message.
+	* include/freetype/config/ftoption.h (FT_MAX_MODULES): Increased
+	to 32.
+
 2002-09-10  Werner Lemberg  <wl@gnu.org>
 
 	* builds/unix/configure.ac (version_info): Set to 9:2:3.
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 4659025..e4d8e47 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -301,9 +301,9 @@ FT_BEGIN_HEADER
   /* FT_MAX_MODULES                                                        */
   /*                                                                       */
   /*   The maximum number of modules that can be registered in a single    */
-  /*   FreeType library object.  16 is the default.                        */
+  /*   FreeType library object.  32 is the default.                        */
   /*                                                                       */
-#define FT_MAX_MODULES  16
+#define FT_MAX_MODULES  32
 
 
   /*************************************************************************/
diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h
index 85dc88b..67d80b3 100644
--- a/include/freetype/ftimage.h
+++ b/include/freetype/ftimage.h
@@ -28,7 +28,10 @@
 #define __FTIMAGE_H__
 
 
+/* _STANDALONE_ is from ftgrays.c */
+#ifndef _STANDALONE_
 #include <ft2build.h>
+#endif
 
 
 FT_BEGIN_HEADER
diff --git a/src/base/ftinit.c b/src/base/ftinit.c
index 7b92dc4..79ba9f0 100644
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -93,7 +93,7 @@
       /* notify errors, but don't stop */
       if ( error )
       {
-        FT_ERROR(( "FT_Add_Default_Module: Cannot install `%s', error = %x\n",
+        FT_ERROR(( "FT_Add_Default_Module: Cannot install `%s', error = 0x%x\n",
                    (*cur)->module_name, error ));
       }
       cur++;
diff --git a/src/pcf/pcfdriver.c b/src/pcf/pcfdriver.c
index 74e96ba..ec478cd 100644
--- a/src/pcf/pcfdriver.c
+++ b/src/pcf/pcfdriver.c
@@ -206,7 +206,7 @@ THE SOFTWARE.
     FT_FREE( face->charset_encoding );
     FT_FREE( face->charset_registry );
 
-    FT_TRACE4(( "DONE_FACE!!!\n" ));
+    FT_TRACE4(( "PCF_Face_Done: done face\n" ));
 
     return PCF_Err_Ok;
   }
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 3d6dad8..f519d31 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -22,10 +22,10 @@
   /* put the files `ftgrays.h' and `ftimage.h' into the current            */
   /* compilation directory.  Typically, you could do something like        */
   /*                                                                       */
-  /* - copy `src/base/ftgrays.c' to your current directory                 */
+  /* - copy `src/smooth/ftgrays.c' (this file) to your current directory   */
   /*                                                                       */
-  /* - copy `include/freetype/ftimage.h' and `include/freetype/ftgrays.h'  */
-  /*   to the same directory                                               */
+  /* - copy `include/freetype/ftimage.h' and `src/smooth/ftgrays.h' to the */
+  /*   same directory                                                      */
   /*                                                                       */
   /* - compile `ftgrays' with the _STANDALONE_ macro defined, as in        */
   /*                                                                       */
@@ -106,14 +106,19 @@
 #include <limits.h>
 #define FT_UINT_MAX  UINT_MAX
 
-#define  ft_setjmp   setjmp
-#define  ft_longjmp  longjmp
-#define  ft_jmp_buf  jmp_buf
+#define ft_memset   memset
+
+#define ft_setjmp   setjmp
+#define ft_longjmp  longjmp
+#define ft_jmp_buf  jmp_buf
 
 
 #define ErrRaster_Invalid_Mode     -2
 #define ErrRaster_Invalid_Outline  -1
 
+#define FT_BEGIN_HEADER
+#define FT_END_HEADER
+
 #include "ftimage.h"
 #include "ftgrays.h"
 
@@ -156,6 +161,10 @@
 #define FT_MEM_SET( d, s, c )  ft_memset( d, s, c )
 #endif
 
+#ifndef FT_MEM_ZERO
+#define FT_MEM_ZERO( dest, count )  FT_MEM_SET( dest, 0, count )
+#endif
+
   /* define this to dump debugging information */
 #define xxxDEBUG_GRAYS
 
@@ -210,7 +219,7 @@
   /* increases the number of cells available in the render pool but slows  */
   /* down the rendering a bit.  It is useful if you have a really tiny     */
   /* render pool.                                                          */
-#undef  GRAYS_COMPACT
+#undef GRAYS_COMPACT
 
 
   /*************************************************************************/
@@ -316,7 +325,7 @@
     ft_jmp_buf  jump_buffer;
 
 #ifdef GRAYS_USE_GAMMA
-    FT_Byte  gamma[257];
+    unsigned char  gamma[257];
 #endif
 
   } TRaster, *PRaster;
@@ -1284,11 +1293,11 @@
 
     for ( ; count > 0; count--, spans++ )
     {
-      FT_UInt  coverage = spans->coverage;
+      unsigned char  coverage = spans->coverage;
 
 
 #ifdef GRAYS_USE_GAMMA
-      coverage = raster->gamma[(FT_Byte)coverage];
+      coverage = raster->gamma[coverage];
 #endif
 
       if ( coverage )
@@ -2033,7 +2042,7 @@
   static void
   grays_init_gamma( PRaster  raster )
   {
-    FT_UInt  x, a;
+    unsigned int  x, a;
 
 
     for ( x = 0; x < 256; x++ )
@@ -2044,7 +2053,7 @@
         a = M_Y + ( ( x - M_X ) * ( M_MAX - M_Y ) +
             ( M_MAX - M_X ) / 2 ) / ( M_MAX - M_X );
 
-      raster->gamma[x] = (FT_Byte)a;
+      raster->gamma[x] = (unsigned char)a;
     }
   }