Commit 83c0ebabc2125215d8179fb777366fbce9777bb8

Werner Lemberg 2012-06-27T08:16:06

Fix conditional compilation. * include/freetype/internal/ftcalc.h (FT_MulDiv_No_Round): Don't enclose with `TT_USE_BYTECODE_INTERPRETER'; we now need the function elsewhere also. * src/autofit/afcjk.h: Use AF_CONFIG_OPTION_CJK. * src/truetype/ttgload.c (tt_loader_init): Fix compiler warning. * src/truetype/ttinterp.c (Ins_MSIRP): Fix compiler warning. * src/truetype/ttinterp.h: Use TT_CONFIG_OPTION_BYTECODE_INTERPRETER.

diff --git a/ChangeLog b/ChangeLog
index a213a5d..b6d9cbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2012-06-27  Werner Lemberg  <wl@gnu.org>
+
+	Fix conditional compilation.
+
+	* include/freetype/internal/ftcalc.h (FT_MulDiv_No_Round): Don't
+	enclose with `TT_USE_BYTECODE_INTERPRETER'; we now need the function
+	elsewhere also.
+
+	* src/autofit/afcjk.h: Use AF_CONFIG_OPTION_CJK.
+
+	* src/truetype/ttgload.c (tt_loader_init): Fix compiler warning.
+
+	* src/truetype/ttinterp.c (Ins_MSIRP): Fix compiler warning.
+
+	* src/truetype/ttinterp.h: Use
+	TT_CONFIG_OPTION_BYTECODE_INTERPRETER.
+
 2012-06-26  Infinality  <infinality@infinality.net>
 
 	[truetype] Remove unused rounding functionality.
@@ -22,7 +39,7 @@
 	(Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP,
 	Ins_MDRP, Ins_MIRP): Perform Round_None instead of calling a modified
 	rounding function.  Remove gridlines_per_pixel.  Create a local
-	variable to store control value cutin. Simplify the conditional for 
+	variable to store control value cutin. Simplify the conditional for
 	ignore_x_mode.  Adjust rounding calls to pass only two values.
 
 2012-06-25  Werner Lemberg  <wl@gnu.org>
diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h
index 0d8d478..a6a5e05 100644
--- a/include/freetype/internal/ftcalc.h
+++ b/include/freetype/internal/ftcalc.h
@@ -78,8 +78,6 @@ FT_BEGIN_HEADER
   /*************************************************************************/
 
 
-#ifdef TT_USE_BYTECODE_INTERPRETER
-
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -108,8 +106,6 @@ FT_BEGIN_HEADER
                       FT_Long  b,
                       FT_Long  c );
 
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
 
   /*
    *  A variant of FT_Matrix_Multiply which scales its result afterwards.
diff --git a/src/autofit/afcjk.h b/src/autofit/afcjk.h
index 8416c0d..dc8f892 100644
--- a/src/autofit/afcjk.h
+++ b/src/autofit/afcjk.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter hinting routines for CJK script (specification).         */
 /*                                                                         */
-/*  Copyright 2006, 2007, 2011 by                                          */
+/*  Copyright 2006, 2007, 2011, 2012 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -103,6 +103,7 @@ FT_BEGIN_HEADER
   } AF_CJKMetricsRec, *AF_CJKMetrics;
 
 
+#ifdef AF_CONFIG_OPTION_CJK
   FT_LOCAL( FT_Error )
   af_cjk_metrics_init( AF_CJKMetrics  metrics,
                        FT_Face        face );
@@ -129,6 +130,7 @@ FT_BEGIN_HEADER
   af_cjk_metrics_init_widths( AF_CJKMetrics  metrics,
                               FT_Face        face,
                               FT_ULong       charcode );
+#endif /* AF_CONFIG_OPTION_CJK */
 
 
 /* */
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index a88a705..63d3773 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1899,7 +1899,9 @@
   {
     TT_Face    face;
     FT_Stream  stream;
+#ifdef TT_USE_BYTECODE_INTERPRETER
     FT_Bool    pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
+#endif
 
 
     face   = (TT_Face)glyph->face;
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 46ffc51..a996d17 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -2204,7 +2204,7 @@
     }
     else
     {
-      val = - FT_PIX_CEIL( compensation - distance );
+      val = -FT_PIX_CEIL( compensation - distance );
       if ( val > 0 )
         val = 0;
     }
@@ -2415,8 +2415,9 @@
   /*    Sets Super Round parameters.                                       */
   /*                                                                       */
   /* <Input>                                                               */
-  /*    GridPeriod :: Grid period                                          */
-  /*    selector   :: SROUND opcode                                        */
+  /*    GridPeriod :: The grid period.                                     */
+  /*                                                                       */
+  /*    selector   :: The SROUND opcode.                                   */
   /*                                                                       */
   static void
   SetSuperRound( EXEC_OP_ FT_F26Dot6  GridPeriod,
@@ -6203,17 +6204,17 @@
   Ins_MSIRP( INS_ARG )
   {
     FT_UShort   point;
-    FT_F26Dot6  distance,
-                control_value_cutin;
+    FT_F26Dot6  distance;
+#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
+    FT_F26Dot6  control_value_cutin;
 
 
     control_value_cutin = CUR.GS.control_value_cutin;
 
-#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
     if ( CUR.ignore_x_mode                                 &&
          CUR.GS.freeVector.x != 0                          &&
          !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
-        control_value_cutin = 0;
+      control_value_cutin = 0;
 #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
 
     point = (FT_UShort)args[0];
@@ -6266,8 +6267,8 @@
   Ins_MDAP( INS_ARG )
   {
     FT_UShort   point;
-    FT_F26Dot6  cur_dist,
-                distance;
+    FT_F26Dot6  cur_dist;
+    FT_F26Dot6  distance;
 
 
     point = (FT_UShort)args[0];
@@ -6283,13 +6284,16 @@
     {
       cur_dist = CUR_fast_project( &CUR.zp0.cur[point] );
 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-      if ( CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 )
-        distance = ROUND_None( cur_dist,
-                               CUR.tt_metrics.compensations[0] ) - cur_dist;
+      if ( CUR.ignore_x_mode        &&
+           CUR.GS.freeVector.x != 0 )
+        distance = ROUND_None(
+                     cur_dist,
+                     CUR.tt_metrics.compensations[0] ) - cur_dist;
       else
 #endif
-      distance = CUR_Func_round( cur_dist,
-                                 CUR.tt_metrics.compensations[0] ) - cur_dist;
+        distance = CUR_Func_round(
+                     cur_dist,
+                     CUR.tt_metrics.compensations[0] ) - cur_dist;
     }
     else
       distance = 0;
@@ -6312,20 +6316,20 @@
   {
     FT_ULong    cvtEntry;
     FT_UShort   point;
-    FT_F26Dot6  distance,
-                org_dist,
-                control_value_cutin;
+    FT_F26Dot6  distance;
+    FT_F26Dot6  org_dist;
+    FT_F26Dot6  control_value_cutin;
 
 
     control_value_cutin = CUR.GS.control_value_cutin;
-    cvtEntry = (FT_ULong)args[1];
-    point    = (FT_UShort)args[0];
+    cvtEntry            = (FT_ULong)args[1];
+    point               = (FT_UShort)args[0];
 
 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
     if ( CUR.ignore_x_mode                                 &&
          CUR.GS.freeVector.x != 0                          &&
          !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
-        control_value_cutin = 0;
+      control_value_cutin = 0;
 #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
 
     if ( BOUNDS( point,     CUR.zp0.n_points ) ||
@@ -6379,18 +6383,20 @@
 
     org_dist = CUR_fast_project( &CUR.zp0.cur[point] );
 
-    if ( ( CUR.opcode & 1 ) != 0 )   /* rounding and control cutin flag */
+    if ( ( CUR.opcode & 1 ) != 0 )   /* rounding and control cut-in flag */
     {
       if ( FT_ABS( distance - org_dist ) > control_value_cutin )
         distance = org_dist;
 
 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
-      if ( CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 )
+      if ( CUR.ignore_x_mode        &&
+           CUR.GS.freeVector.x != 0 )
         distance = ROUND_None( distance,
                                CUR.tt_metrics.compensations[0] );
       else
 #endif
-      distance = CUR_Func_round( distance, CUR.tt_metrics.compensations[0] );
+        distance = CUR_Func_round( distance,
+                                   CUR.tt_metrics.compensations[0] );
     }
 
     CUR_Func_move( &CUR.zp0, point, distance - org_dist );
@@ -6414,13 +6420,13 @@
     FT_F26Dot6  org_dist, distance, minimum_distance;
 
 
-    minimum_distance    = CUR.GS.minimum_distance;
+    minimum_distance = CUR.GS.minimum_distance;
 
 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
     if ( CUR.ignore_x_mode                                 &&
          CUR.GS.freeVector.x != 0                          &&
          !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
-        minimum_distance = 0;
+      minimum_distance = 0;
 #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
 
 
@@ -6561,14 +6567,14 @@
 
     minimum_distance    = CUR.GS.minimum_distance;
     control_value_cutin = CUR.GS.control_value_cutin;
-    point    = (FT_UShort)args[0];
-    cvtEntry = (FT_ULong)( args[1] + 1 );
+    point               = (FT_UShort)args[0];
+    cvtEntry            = (FT_ULong)( args[1] + 1 );
 
 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
     if ( CUR.ignore_x_mode                                 &&
          CUR.GS.freeVector.x != 0                          &&
          !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
-        control_value_cutin = minimum_distance = 0;
+      control_value_cutin = minimum_distance = 0;
 #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
 
     /* XXX: UNDOCUMENTED! cvt[-1] = 0 always */
diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h
index 2fc476d..076d9a1 100644
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -301,6 +301,7 @@ FT_BEGIN_HEADER
   extern const TT_GraphicsState  tt_default_graphics_state;
 
 
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
   FT_LOCAL( FT_Error )
   TT_Goto_CodeRange( TT_ExecContext  exec,
                      FT_Int          range,
@@ -323,6 +324,7 @@ FT_BEGIN_HEADER
               FT_Long    multiplier,
               void*      _pbuff,
               FT_ULong   new_max );
+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
 
   /*************************************************************************/
@@ -347,6 +349,8 @@ FT_BEGIN_HEADER
   FT_EXPORT( TT_ExecContext )
   TT_New_Context( TT_Driver  driver );
 
+
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
   FT_LOCAL( FT_Error )
   TT_Done_Context( TT_ExecContext  exec );
 
@@ -362,6 +366,7 @@ FT_BEGIN_HEADER
   FT_LOCAL( FT_Error )
   TT_Run_Context( TT_ExecContext  exec,
                   FT_Bool         debug );
+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
 
   /*************************************************************************/