Commit 7dff772e5912f070325dae79008a1ae31ea5989e

Werner Lemberg 2000-01-17T08:24:22

Added ftraster.h for better support of standalone mode. Fixed cleaning rules for the demo programs.

diff --git a/demos/Makefile b/demos/Makefile
index 30fa35f..8c5f526 100644
--- a/demos/Makefile
+++ b/demos/Makefile
@@ -1,4 +1,3 @@
-.PHONY: exes
 all: exes
 
 ####################################################################
@@ -21,10 +20,10 @@ no_config_mk := 1
 endif
 
 ifdef no_config_mk
-
 exes:
 	@echo Please compile the library before the demo programs!
-
+clean distclean:
+	@echo "I need \`../config.mk' to do that!"
 else
 
 ####################################################################
@@ -36,6 +35,33 @@ include ../config.mk
 
 ####################################################################
 #
+# Define a few important variables now
+#
+#
+TOP_ := $(TOP)$(SEP)
+SRC_ := $(TOP)$(SEP)src$(SEP)
+
+BIN_ := bin$(SEP)
+OBJ_ := obj$(SEP)
+
+GRAPH_DIR := graph
+
+SRC_DIR  := src
+SRC_DIR_ := $(SRC_DIR)$(SEP)
+
+
+.PHONY: exes clean distclean
+
+###################################################################
+#
+# Include the rules needed to compile the graphics sub-system.
+# This will also select which graphics driver to compile to the
+# sub-system..
+#
+include $(GRAPH_DIR)/rules.mk
+
+####################################################################
+#
 # Detect DOS-like platforms, currently DOS, Win 3.1, Win32 & OS/2
 #
 #
@@ -50,7 +76,6 @@ endif
 # cannot take a long list of arguments, we simply erase the directory
 # contents..
 #
-.PHONY: clean distclean
 
 ifdef DOSLIKE
 clean_demo:
@@ -65,31 +90,14 @@ clean_demo:
 	-$(DELETE) $(OBJ_)*.$O
 	-$(DELETE) $(SRC_)*.bak graph$(SEP)*.bak
 	-$(DELETE) $(SRC_)*~ graph$(SEP)*~
-
-
 distclean_demo: clean_demo
 	-$(DELETE) $(EXES:%=$(BIN_)%)
+	-$(DELETE) $(GRAPH_LIB)
 endif
 
 clean: clean_demo
 distclean: distclean_demo
 
-####################################################################
-#
-# Define a few important variables now
-#
-#
-TOP_ := $(TOP)$(SEP)
-SRC_ := $(TOP)$(SEP)src$(SEP)
-
-BIN_ := bin$(SEP)
-OBJ_ := obj$(SEP)
-
-GRAPH_DIR := graph
-
-SRC_DIR  := src
-SRC_DIR_ := $(SRC_DIR)$(SEP)
-
 
 FT_INCLUDES := $(BUILD) $(TOP_)include $(SRC_)base
 TT_INCLUDES := $(SRC_)shared $(SRC_)truetype
@@ -122,14 +130,6 @@ ifneq ($(findstring $(PLATFORM),os2 unix),)
 EXES += ttdebug
 endif
 
-###################################################################
-#
-# Include the rules needed to compile the graphics sub-system.
-# This will also select which graphics driver to compile to the
-# sub-system..
-#
-include $(GRAPH_DIR)/rules.mk
-
 exes: $(EXES:%=$(BIN_)%$E)
 
 
@@ -223,5 +223,3 @@ $(BIN_)fttimer$E: $(OBJ_)fttimer.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ)
 	$(LINK) $(LFLAGS) $T$@ $< $(FTLIB) $(GRAPH_LINK) $(EFENCE)
 
 endif
-
-
diff --git a/include/ftraster.h b/include/ftraster.h
new file mode 100644
index 0000000..1e0ecb3
--- /dev/null
+++ b/include/ftraster.h
@@ -0,0 +1,68 @@
+/***************************************************************************/
+/*                                                                         */
+/*  ftraster.h                                                             */
+/*                                                                         */
+/*    The FreeType glyph rasterizer (specification).                       */
+/*                                                                         */
+/*  Copyright 1996-2000 by                                                 */
+/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
+/*                                                                         */
+/*  This file is part of the FreeType project, and may only be used        */
+/*  modified and distributed under the terms of the FreeType project       */
+/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
+/*  this file you indicate that you have read the license and              */
+/*  understand and accept it fully.                                        */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef FTRASTER_H
+#define FTRASTER_H
+
+#ifdef __cplusplus
+  extern "C" {
+#endif
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* Uncomment the following line if you are using ftraster.c as a         */
+  /* standalone module, fully independent of FreeType.                     */
+  /*                                                                       */
+/* #define _STANDALONE_ */
+
+#include <ftimage.h>
+
+#ifndef EXPORT_DEF
+#define EXPORT_DEF  /* nothing */
+#endif
+
+  EXPORT_DEF
+  int  FT_Raster_Init( FT_Raster    raster,
+                       const char*  pool_base,
+                       long         pool_size );
+
+  EXPORT_DEF
+  int  FT_Raster_Render( FT_Raster    raster,
+                         FT_Outline*  outline,
+                         FT_Bitmap*   target_map );
+
+  EXPORT_DEF
+  long  FT_Raster_ObjSize( void );
+
+  /* FT_Raster_SetPalette() is currently unused by FreeType 2 */
+
+  EXPORT_DEF
+  int  FT_Raster_SetPalette( FT_Raster    raster,
+                             int          count,
+                             const char*  palette );
+
+
+#ifdef __cplusplus
+  }
+#endif
+
+#endif /* FTRASTER_H */
+
+
+/* END */
diff --git a/src/base/ftraster.c b/src/base/ftraster.c
index b0059a1..99dcf35 100644
--- a/src/base/ftraster.c
+++ b/src/base/ftraster.c
@@ -1,10 +1,10 @@
 /***************************************************************************/
 /*                                                                         */
-/*  ftraster2.c                                                            */
+/*  ftraster.c                                                             */
 /*                                                                         */
 /*    The FreeType glyph rasterizer (body).                                */
 /*                                                                         */
-/*  Copyright 1996-1999 by                                                 */
+/*  Copyright 1996-2000 by                                                 */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used        */
@@ -53,7 +53,7 @@
   /*************************************************************************/
 
 
-#include <ftimage.h>
+#include <ftraster.h>
 #ifndef _STANDALONE_
 #include <ftconfig.h>
 #endif
@@ -2236,13 +2236,12 @@
   /* <Return>                                                              */
   /*    Error code.  0 means sucess.                                       */
   /*                                                                       */
-
-
+  static
   int  FT_Decompose_Outline( FT_Outline*        outline,
                              FT_Outline_Funcs*  interface,
                              void*              user )
   {
-    typedef enum _phases
+    typedef enum  _phases
     {
       phase_point,
       phase_conic,
@@ -2478,7 +2477,8 @@
   static
   TResult  Convert_Glyph( RAS_ARG_ FT_Outline*  outline )
   {
-    static FT_Outline_Funcs  interface =
+    static
+    FT_Outline_Funcs  interface =
     {
       (FT_Outline_MoveTo_Func)Move_To,
       (FT_Outline_LineTo_Func)Line_To,
@@ -2519,8 +2519,8 @@
   /*                                                                       */
   /*    Inits an empty linked list.                                        */
   /*                                                                       */
-  static void
-  Init_Linked( TProfileList*  l )
+  static
+  void  Init_Linked( TProfileList*  l )
   {
     *l = NULL;
   }