shithub: freetype+ttf2subf

Download patch

ref: 8e3fc5ea0c37ff52955aaff6ffe8325ac478bb77
parent: 89fff9b9d193fdf97073d085cdb99bcb9823dda8
author: Werner Lemberg <[email protected]>
date: Wed Aug 3 17:17:53 EDT 2005

* src/otvalid/otvcommn.h: Remove dead code.

Formatting.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,16 @@
+2005-08-02  Werner Lemberg  <[email protected]>
+
+	* src/otvalid/otvcommn.h: Remove dead code.
+
 2005-07-31  Chia I Wu  <[email protected]>
 
-	* src/truetype/ttobjs.h (tt_size_run_fpgm, tt_size_run_prep): New functions.
+	* src/truetype/ttobjs.h (tt_size_run_fpgm, tt_size_run_prep): New
+	functions.
 
-	* src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): New functions.
-	(tt_size_init): Add 4, instead of 2, (phantom) points to twilight zone.
+	* src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): New
+	functions.
+	(tt_size_init): Add 4, instead of 2, (phantom) points to twilight
+	zone.
 	Move code that runs fpgm to tt_size_run_fpgm.
 	(Reset_Outline_Size): Move code that runs prep to tt_size_run_prep.
 	(tt_glyphzone_new): Allocate right size of arrays.
@@ -29,14 +36,27 @@
 
 2005-06-30  David Turner  <[email protected]>
 
-        * src/sfnt/ftbitmap.c, src/truetype/ttgload.c, src/sfnt/ttcmap.c:
-        removing compiler warnings (Visual C++ /W4)
+	* src/sfnt/ftbitmap.c, src/truetype/ttgload.c, src/sfnt/ttcmap.c:
+	Removing compiler warnings (Visual C++ /W4).
 
-        * Jamfile, src/otvalid/{otvcommn.h,otvgdef.c,otvgpos.c,otvgsub.c,
-        otvjstf.c}: modified the code to use a different pre-processor trick
-        to implement the OTV_NEST1, OTV_NEST2 and OTV_NEST3 macros. The code
-        now compiles neatly with Visual C++. The 'otvalid' module has been
-        put in the Jamfile build again.
+
+	Implement a work-around for broken C preprocessor in Visual C++ (it
+	has been confirmed by the MS developers that it is indeed a bug
+	which won't be fixed in the very near future).
+
+	* Jamfile (FT2_COMPONENTS): Include otvalid (again).
+
+	* src/otvalid/otvcommn.h (OTV_NAME, OTV_FUNC): New macros.
+	(OTV_NEST1, OTV_NEST2, OTV_NEST3): Use OTV_NAME and OTV_FUNC to
+	avoid argument expansion by argument prescan.
+	Append `Func' to all affected macros and change them to take just a
+	single argument.  Example: `AttachList' is renamed to
+	`AttachListFunc'.
+
+	* src/otvalid/otvgdef.c, src/otvalid/otvgpos.c,
+	src/otvalid/otvgsub.c, src/otvjstf.c: Append `Func' to macros
+	affected by the changes to OTV_NESTx and modify them to take just a
+	single argument.
 
 2005-06-20  Chia I Wu  <[email protected]>
 
--- a/src/otvalid/otvcommn.h
+++ b/src/otvalid/otvcommn.h
@@ -117,34 +117,31 @@
 
 #ifdef FT_DEBUG_LEVEL_TRACE
 
-  /* use preprocessor's argument prescan to expand one argument into two */
 #define OTV_NEST1( x )                                     \
           FT_BEGIN_STMNT                                   \
             valid->nesting_level          = 0;             \
-            valid->func[0]                = OTV_FUNC(x);   \
-            valid->debug_function_name[0] = OTV_NAME(x);   \
+            valid->func[0]                = OTV_FUNC( x ); \
+            valid->debug_function_name[0] = OTV_NAME( x ); \
           FT_END_STMNT
 
-  /* use preprocessor's argument prescan to expand two arguments into four */
-#define OTV_NEST2( x, y )                                   \
-          FT_BEGIN_STMNT                                    \
-            valid->nesting_level          = 0;              \
-            valid->func[0]                = OTV_FUNC(x);    \
-            valid->func[1]                = OTV_FUNC(y);    \
-            valid->debug_function_name[0] = OTV_NAME(x);    \
-            valid->debug_function_name[1] = OTV_NAME(y);    \
+#define OTV_NEST2( x, y )                                  \
+          FT_BEGIN_STMNT                                   \
+            valid->nesting_level          = 0;             \
+            valid->func[0]                = OTV_FUNC( x ); \
+            valid->func[1]                = OTV_FUNC( y ); \
+            valid->debug_function_name[0] = OTV_NAME( x ); \
+            valid->debug_function_name[1] = OTV_NAME( y ); \
           FT_END_STMNT
 
-  /* use preprocessor's argument prescan to expand three arguments into six */
-#define OTV_NEST3( x, y, z )                                \
-          FT_BEGIN_STMNT                                    \
-            valid->nesting_level          = 0;              \
-            valid->func[0]                = OTV_FUNC(x);    \
-            valid->func[1]                = OTV_FUNC(y);    \
-            valid->func[2]                = OTV_FUNC(z);    \
-            valid->debug_function_name[0] = OTV_NAME(x);    \
-            valid->debug_function_name[1] = OTV_NAME(y);    \
-            valid->debug_function_name[2] = OTV_NAME(z);    \
+#define OTV_NEST3( x, y, z )                               \
+          FT_BEGIN_STMNT                                   \
+            valid->nesting_level          = 0;             \
+            valid->func[0]                = OTV_FUNC( x ); \
+            valid->func[1]                = OTV_FUNC( y ); \
+            valid->func[2]                = OTV_FUNC( z ); \
+            valid->debug_function_name[0] = OTV_NAME( x ); \
+            valid->debug_function_name[1] = OTV_NAME( y ); \
+            valid->debug_function_name[2] = OTV_NAME( z ); \
           FT_END_STMNT
 
 #define OTV_INIT  valid->debug_indent = 0
@@ -174,28 +171,25 @@
 
 #else   /* !FT_DEBUG_LEVEL_TRACE */
 
-  /* use preprocessor's argument prescan to expand one argument into two */
-#define OTV_NEST1( x )                          \
-          FT_BEGIN_STMNT                        \
-            valid->nesting_level = 0;           \
-            valid->func[0]       = OTV_FUNC(x); \
+#define OTV_NEST1( x )                            \
+          FT_BEGIN_STMNT                          \
+            valid->nesting_level = 0;             \
+            valid->func[0]       = OTV_FUNC( x ); \
           FT_END_STMNT
 
-  /* use preprocessor's argument prescan to expand two arguments into four */
-#define OTV_NEST2( x, y )                        \
-          FT_BEGIN_STMNT                         \
-            valid->nesting_level = 0;            \
-            valid->func[0]       = OTV_FUNC(x);  \
-            valid->func[1]       = OTV_FUNC(y);  \
+#define OTV_NEST2( x, y )                         \
+          FT_BEGIN_STMNT                          \
+            valid->nesting_level = 0;             \
+            valid->func[0]       = OTV_FUNC( x ); \
+            valid->func[1]       = OTV_FUNC( y ); \
           FT_END_STMNT
 
-  /* use preprocessor's argument prescan to expand three arguments into six */
-#define OTV_NEST3( x, y, z )                     \
-          FT_BEGIN_STMNT                         \
-            valid->nesting_level = 0;            \
-            valid->func[0]       = OTV_FUNC(x);  \
-            valid->func[1]       = OTV_FUNC(y);  \
-            valid->func[2]       = OTV_FUNC(z);  \
+#define OTV_NEST3( x, y, z )                      \
+          FT_BEGIN_STMNT                          \
+            valid->nesting_level = 0;             \
+            valid->func[0]       = OTV_FUNC( x ); \
+            valid->func[1]       = OTV_FUNC( y ); \
+            valid->func[2]       = OTV_FUNC( z ); \
           FT_END_STMNT
 
 #define OTV_INIT                do ; while ( 0 )
@@ -338,22 +332,6 @@
   /*************************************************************************/
   /*************************************************************************/
 
-#if 0
-#define ChainPosClassSet  otv_x_Ox, "ChainPosClassSet"
-#define ChainPosRuleSet   otv_x_Ox, "ChainPosRuleSet"
-#define ChainSubClassSet  otv_x_Ox, "ChainSubClassSet"
-#define ChainSubRuleSet   otv_x_Ox, "ChainSubRuleSet"
-#define JstfLangSys       otv_x_Ox, "JstfLangSys"
-#define JstfMax           otv_x_Ox, "JstfMax"
-#define LigGlyph          otv_x_Ox, "LigGlyph"
-#define LigatureArray     otv_x_Ox, "LigatureArray"
-#define LigatureSet       otv_x_Ox, "LigatureSet"
-#define PosClassSet       otv_x_Ox, "PosClassSet"
-#define PosRuleSet        otv_x_Ox, "PosRuleSet"
-#define SubClassSet       otv_x_Ox, "SubClassSet"
-#define SubRuleSet        otv_x_Ox, "SubRuleSet"
-#endif
-
 #define ChainPosClassSetFunc  otv_x_Ox
 #define ChainPosRuleSetFunc   otv_x_Ox
 #define ChainSubClassSetFunc  otv_x_Ox
@@ -372,16 +350,6 @@
   otv_x_Ox ( FT_Bytes       table,
              OTV_Validator  valid );
 
-#if 0
-#define AlternateSubstFormat1     otv_u_C_x_Ox, "AlternateSubstFormat1"
-#define ChainContextPosFormat1    otv_u_C_x_Ox, "ChainContextPosFormat1"
-#define ChainContextSubstFormat1  otv_u_C_x_Ox, "ChainContextSubstFormat1"
-#define ContextPosFormat1         otv_u_C_x_Ox, "ContextPosFormat1"
-#define ContextSubstFormat1       otv_u_C_x_Ox, "ContextSubstFormat1"
-#define LigatureSubstFormat1      otv_u_C_x_Ox, "LigatureSubstFormat1"
-#define MultipleSubstFormat1      otv_u_C_x_Ox, "MultipleSubstFormat1"
-#endif
-
 #define AlternateSubstFormat1Func     otv_u_C_x_Ox
 #define ChainContextPosFormat1Func    otv_u_C_x_Ox
 #define ChainContextSubstFormat1Func  otv_u_C_x_Ox
@@ -390,19 +358,10 @@
 #define LigatureSubstFormat1Func      otv_u_C_x_Ox
 #define MultipleSubstFormat1Func      otv_u_C_x_Ox
 
-
   FT_LOCAL( void )
   otv_u_C_x_Ox( FT_Bytes       table,
                 OTV_Validator  valid );
 
-#if 0
-#define AlternateSet     otv_x_ux, "AlternateSet"
-#define AttachPoint      otv_x_ux, "AttachPoint"
-#define ExtenderGlyph    otv_x_ux, "ExtenderGlyph"
-#define JstfGPOSModList  otv_x_ux, "JstfGPOSModList"
-#define JstfGSUBModList  otv_x_ux, "JstfGSUBModList"
-#define Sequence         otv_x_ux, "Sequence"
-#endif
 #define AlternateSetFunc     otv_x_ux
 #define AttachPointFunc      otv_x_ux
 #define ExtenderGlyphFunc    otv_x_ux
@@ -414,13 +373,6 @@
   otv_x_ux( FT_Bytes       table,
             OTV_Validator  valid );
 
-#if 0
-#define PosClassRule  otv_x_y_ux_sy, "PosClassRule"
-#define PosRule       otv_x_y_ux_sy, "PosRule"
-#define SubClassRule  otv_x_y_ux_sy, "SubClassRule"
-#define SubRule       otv_x_y_ux_sy, "SubRule"
-#endif
-
 #define PosClassRuleFunc  otv_x_y_ux_sy
 #define PosRuleFunc       otv_x_y_ux_sy
 #define SubClassRuleFunc  otv_x_y_ux_sy
@@ -430,13 +382,6 @@
   otv_x_y_ux_sy( FT_Bytes       table,
                  OTV_Validator  valid );
 
-#if 0
-#define ChainPosClassRule  otv_x_ux_y_uy_z_uz_p_sp, "ChainPosClassRule"
-#define ChainPosRule       otv_x_ux_y_uy_z_uz_p_sp, "ChainPosRule"
-#define ChainSubClassRule  otv_x_ux_y_uy_z_uz_p_sp, "ChainSubClassRule"
-#define ChainSubRule       otv_x_ux_y_uy_z_uz_p_sp, "ChainSubRule"
-#endif
-
 #define ChainPosClassRuleFunc  otv_x_ux_y_uy_z_uz_p_sp
 #define ChainPosRuleFunc       otv_x_ux_y_uy_z_uz_p_sp
 #define ChainSubClassRuleFunc  otv_x_ux_y_uy_z_uz_p_sp
@@ -446,11 +391,6 @@
   otv_x_ux_y_uy_z_uz_p_sp( FT_Bytes       table,
                            OTV_Validator  valid );
 
-#if 0
-#define ContextPosFormat2    otv_u_O_O_x_Onx, "ContextPosFormat2"
-#define ContextSubstFormat2  otv_u_O_O_x_Onx, "ContextSubstFormat2"
-#endif
-
 #define ContextPosFormat2Func    otv_u_O_O_x_Onx
 #define ContextSubstFormat2Func  otv_u_O_O_x_Onx
 
@@ -458,11 +398,6 @@
   otv_u_O_O_x_Onx( FT_Bytes       table,
                    OTV_Validator  valid );
 
-#if 0
-#define ContextPosFormat3    otv_u_x_y_Ox_sy, "ContextPosFormat3"
-#define ContextSubstFormat3  otv_u_x_y_Ox_sy, "ContextSubstFormat3"
-#endif
-
 #define ContextPosFormat3Func    otv_u_x_y_Ox_sy
 #define ContextSubstFormat3Func  otv_u_x_y_Ox_sy
 
@@ -470,11 +405,6 @@
   otv_u_x_y_Ox_sy( FT_Bytes       table,
                    OTV_Validator  valid );
 
-#if 0
-#define ChainContextPosFormat2        otv_u_O_O_O_O_x_Onx, "ChainContextPosFormat2"
-#define ChainContextSubstFormat2      otv_u_O_O_O_O_x_Onx, "ChainContextSubstFormat2"
-#endif
-
 #define ChainContextPosFormat2Func    otv_u_O_O_O_O_x_Onx
 #define ChainContextSubstFormat2Func  otv_u_O_O_O_O_x_Onx
 
@@ -481,11 +411,6 @@
   FT_LOCAL( void )
   otv_u_O_O_O_O_x_Onx( FT_Bytes       table,
                        OTV_Validator  valid );
-
-#if 0
-#define ChainContextPosFormat3        otv_u_x_Ox_y_Oy_z_Oz_p_sp, "ChainContextPosFormat3"
-#define ChainContextSubstFormat3      otv_u_x_Ox_y_Oy_z_Oz_p_sp, "ChainContextSubstFormat3"
-#endif
 
 #define ChainContextPosFormat3Func    otv_u_x_Ox_y_Oy_z_Oz_p_sp
 #define ChainContextSubstFormat3Func  otv_u_x_Ox_y_Oy_z_Oz_p_sp
--- a/src/otvalid/otvgdef.c
+++ b/src/otvalid/otvgdef.c
@@ -88,7 +88,7 @@
   /*************************************************************************/
   /*************************************************************************/
 
-#define  CaretValueFunc  otv_CaretValue_validate
+#define CaretValueFunc  otv_CaretValue_validate
 
   static void
   otv_CaretValue_validate( FT_Bytes       table,
--- a/src/otvalid/otvgpos.c
+++ b/src/otvalid/otvgpos.c
@@ -861,7 +861,8 @@
       /* context rules since even invalid glyph indices/classes return  */
       /* meaningful results                                             */
 
-      OTV_NEST3( ChainContextPosFormat2,ChainPosClassSet, ChainPosClassRule );
+      OTV_NEST3( ChainContextPosFormat2,
+                 ChainPosClassSet, ChainPosClassRule );
       OTV_RUN( table, valid );
       break;
 
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -176,7 +176,7 @@
     *metrics = size->root.metrics;
 
     /* This bit flag, when set, indicates that the pixel size must be */
-    /* rounded to integer.  Nearly all TrueType fonts have this  bit  */
+    /* rounded to integer.  Nearly all TrueType fonts have this bit   */
     /* set, as hinting won't work really well otherwise.              */
     /*                                                                */
     if ( ( face->header.Flags & 8 ) != 0 )
@@ -183,11 +183,12 @@
     {
       FT_Long  dim_x, dim_y;
 
+
       dim_x = ( char_width  * horz_resolution + 36 ) / 72;
       dim_y = ( char_height * vert_resolution + 36 ) / 72;
 
-      dim_x = FT_PIX_ROUND(dim_x);
-      dim_y = FT_PIX_ROUND(dim_y);
+      dim_x = FT_PIX_ROUND( dim_x );
+      dim_y = FT_PIX_ROUND( dim_y );
 
       metrics->x_ppem  = (FT_UShort)( dim_x >> 6 );
       metrics->y_ppem  = (FT_UShort)( dim_y >> 6 );
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1778,8 +1778,8 @@
         if ( face->os2.version != 0xFFFFU )
         {
           /* sTypoDescender is negative */
-          max_height     = (FT_Short)(face->os2.sTypoAscender -
-                                      face->os2.sTypoDescender);
+          max_height = (FT_Short)(face->os2.sTypoAscender -
+                                  face->os2.sTypoDescender);
 
           top_bearing    = (FT_Short)( ( max_height - height ) / 2 );
           advance_height = (FT_UShort)( max_height + face->os2.sTypoLineGap );
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -133,7 +133,7 @@
     }
     else
     {
-      zone->max_points = maxPoints;
+      zone->max_points   = maxPoints;
       zone->max_contours = maxContours;
     }
 
@@ -321,6 +321,7 @@
   /*************************************************************************/
 
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
@@ -327,7 +328,7 @@
   /*    tt_size_run_fpgm                                                   */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Run the font program                                               */
+  /*    Run the font program.                                              */
   /*                                                                       */
   /* <Input>                                                               */
   /*    size :: A handle to the size object.                               */
@@ -415,7 +416,7 @@
   /*    tt_size_run_prep                                                   */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Run the control value program                                      */
+  /*    Run the control value program.                                     */
   /*                                                                       */
   /* <Input>                                                               */
   /*    size :: A handle to the size object.                               */
@@ -474,6 +475,7 @@
 
     return error;
   }
+
 #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
 
@@ -496,7 +498,9 @@
   {
     TT_Size   size  = (TT_Size)ttsize;
     FT_Error  error = TT_Err_Ok;
+
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
     TT_Face    face   = (TT_Face)size->root.face;
     FT_Memory  memory = face->root.memory;
     FT_Int     i;
@@ -605,7 +609,9 @@
   tt_size_done( FT_Size  ttsize )           /* TT_Size */
   {
     TT_Size    size = (TT_Size)ttsize;
+
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
     FT_Memory  memory = size->root.face->memory;
 
 
@@ -712,6 +718,7 @@
 #endif
 
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
     {
       FT_UInt  i;
 
@@ -738,6 +745,7 @@
 
       error = tt_size_run_prep( size );
     }
+
 #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
     if ( !error )
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Objects manager (specification).                                     */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004 by                               */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -418,11 +418,13 @@
   tt_size_done( FT_Size  ttsize );          /* TT_Size */
 
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
   FT_LOCAL( FT_Error )
   tt_size_run_fpgm( TT_Size  size );
 
   FT_LOCAL( FT_Error )
   tt_size_run_prep( TT_Size  size );
+
 #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
   FT_LOCAL( FT_Error )