Commit dd570e99ab6770657222bf7da8f780b8ea9752a1

Werner Lemberg 2014-10-23T19:57:37

[cff] Work around bug in preprocessor of MSVC 2010. We have been hit by https://connect.microsoft.com/VisualStudio/feedback/details/718976/msvc-pr * devel/ftoption.h, include/config/ftoption.h: Replace `CFF_CONFIG_OPTION_DARKENING_PARAMETERS' with eight macros `CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4}'. * src/cff/cffobjs.c (SET_DARKENING_PARAMETERS): Removed. We no longer need double expansion. (SET_DARKENING_PARAMETERS_0): Renamed to ... (SET_DARKENING_PARAMETERS): ... this. Update call.

diff --git a/ChangeLog b/ChangeLog
index 55c06fb..5632907 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2014-10-23  Werner Lemberg  <wl@gnu.org>
+
+	[cff] Work around bug in preprocessor of MSVC 2010.
+
+	We have been hit by
+
+	  https://connect.microsoft.com/VisualStudio/feedback/details/718976/msvc-pr
+
+	* devel/ftoption.h, include/config/ftoption.h: Replace
+	`CFF_CONFIG_OPTION_DARKENING_PARAMETERS' with eight macros
+	`CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4}'.
+
+	* src/cff/cffobjs.c (SET_DARKENING_PARAMETERS): Removed.  We no
+	longer need double expansion.
+	(SET_DARKENING_PARAMETERS_0): Renamed to ...
+	(SET_DARKENING_PARAMETERS): ... this.
+	Update call.
+
 2014-10-20  Werner Lemberg  <wl@gnu.org>
 
 	[sbit] Minor fixes.
diff --git a/devel/ftoption.h b/devel/ftoption.h
index 97f9cc2..c3d6df3 100644
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -773,19 +773,26 @@ FT_BEGIN_HEADER
 
   /*************************************************************************/
   /*                                                                       */
-  /* Using CFF_CONFIG_OPTION_DARKENING_PARAMETERS it is possible to set up */
-  /* the default values of the four control points that define the stem    */
-  /* darkening behaviour of the (new) CFF engine.  For more details please */
-  /* read the documentation of the `darkening-parameters' property of the  */
-  /* cff driver module (file `ftcffdrv.h'), which allows the control at    */
-  /* run-time.                                                             */
-  /*                                                                       */
-  /* Do *not* undefine this macro!                                         */
-  /*                                                                       */
-#define CFF_CONFIG_OPTION_DARKENING_PARAMETERS   500, 400, \
-                                                1000, 275, \
-                                                1667, 275, \
-                                                2333,   0
+  /* Using CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4} it is      */
+  /* possible to set up the default values of the four control points that */
+  /* define the stem darkening behaviour of the (new) CFF engine.  For     */
+  /* more details please read the documentation of the                     */
+  /* `darkening-parameters' property of the cff driver module (file        */
+  /* `ftcffdrv.h'), which allows the control at run-time.                  */
+  /*                                                                       */
+  /* Do *not* undefine these macros!                                       */
+  /*                                                                       */
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1   500
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1   400
+
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2  1000
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2   275
+
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3  1667
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3   275
+
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4  2333
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4     0
 
 
   /*************************************************************************/
diff --git a/include/config/ftoption.h b/include/config/ftoption.h
index 46979e7..d6fa42a 100644
--- a/include/config/ftoption.h
+++ b/include/config/ftoption.h
@@ -773,19 +773,26 @@ FT_BEGIN_HEADER
 
   /*************************************************************************/
   /*                                                                       */
-  /* Using CFF_CONFIG_OPTION_DARKENING_PARAMETERS it is possible to set up */
-  /* the default values of the four control points that define the stem    */
-  /* darkening behaviour of the (new) CFF engine.  For more details please */
-  /* read the documentation of the `darkening-parameters' property of the  */
-  /* cff driver module (file `ftcffdrv.h'), which allows the control at    */
-  /* run-time.                                                             */
-  /*                                                                       */
-  /* Do *not* undefine this macro!                                         */
-  /*                                                                       */
-#define CFF_CONFIG_OPTION_DARKENING_PARAMETERS   500, 400, \
-                                                1000, 275, \
-                                                1667, 275, \
-                                                2333,   0
+  /* Using CFF_CONFIG_OPTION_DARKENING_PARAMETER_{X,Y}{1,2,3,4} it is      */
+  /* possible to set up the default values of the four control points that */
+  /* define the stem darkening behaviour of the (new) CFF engine.  For     */
+  /* more details please read the documentation of the                     */
+  /* `darkening-parameters' property of the cff driver module (file        */
+  /* `ftcffdrv.h'), which allows the control at run-time.                  */
+  /*                                                                       */
+  /* Do *not* undefine these macros!                                       */
+  /*                                                                       */
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1   500
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1   400
+
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2  1000
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2   275
+
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3  1667
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3   275
+
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4  2333
+#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4     0
 
 
   /*************************************************************************/
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index b42aa88..b6d807e 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -1049,11 +1049,11 @@
   }
 
 
-#define SET_DARKENING_PARAMETERS_0( driver,                                \
-                                    x1, y1,                                \
-                                    x2, y2,                                \
-                                    x3, y3,                                \
-                                    x4, y4 )                               \
+#define SET_DARKENING_PARAMETERS( driver,                                  \
+                                  x1, y1,                                  \
+                                  x2, y2,                                  \
+                                  x3, y3,                                  \
+                                  x4, y4 )                                 \
           FT_BEGIN_STMNT                                                   \
             /* checks copied from `cff_property_set' in `cffdrivr.c' */    \
             typedef int  static_assert_darkening_parameters[               \
@@ -1073,9 +1073,6 @@
             driver->darken_params[7] = y4;                                 \
           FT_END_STMNT
 
-#define SET_DARKENING_PARAMETERS( driver, params )     \
-          SET_DARKENING_PARAMETERS_0( driver, params )
-
 
   FT_LOCAL_DEF( FT_Error )
   cff_driver_init( FT_Module  module )        /* CFF_Driver */
@@ -1092,7 +1089,14 @@
     driver->no_stem_darkening = FALSE;
 
     SET_DARKENING_PARAMETERS( driver,
-                              CFF_CONFIG_OPTION_DARKENING_PARAMETERS );
+                              CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1,
+                              CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1,
+                              CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2,
+                              CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2,
+                              CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3,
+                              CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3,
+                              CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4,
+                              CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 );
 
     return FT_Err_Ok;
   }