shithub: freetype+ttf2subf

Download patch

ref: f79df78a533cb2bded1442eaafcf8c624ede45e0
parent: 96d389835a341e37d9c16825c4e2692aa940fe50
author: Werner Lemberg <[email protected]>
date: Sun Jun 21 16:17:01 EDT 2009

Code beautification.

* src/type1/t1load.c (FT_INT_TO_FIXED): Removed.
Replace everywhere with INT_TO_FIXED.
(FT_FIXED_TO_INT): Move to ...
* include/freetype/internal/ftcalc.h (FIXED_TO_INT): Here.
Update all users.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-06-21  Werner Lemberg  <[email protected]>
+
+	Code beautification.
+
+	* src/type1/t1load.c (FT_INT_TO_FIXED): Removed.
+	Replace everywhere with INT_TO_FIXED.
+	(FT_FIXED_TO_INT): Move to ...
+	* include/freetype/internal/ftcalc.h (FIXED_TO_INT): Here.
+	Update all users.
+
 2009-06-20  Werner Lemberg  <[email protected]>
 
 	Remove unused variables.
--- a/include/freetype/internal/ftcalc.h
+++ b/include/freetype/internal/ftcalc.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Arithmetic computations (specification).                             */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -165,6 +165,7 @@
 #define INT_TO_FIXED( x )      ( (FT_Long)(x) << 16 )
 #define F2DOT14_TO_FIXED( x )  ( (FT_Long)(x) << 2  )
 #define FLOAT_TO_FIXED( x )    ( (FT_Long)( x * 65536.0 ) )
+#define FIXED_TO_INT( x )      ( FT_RoundFix( x ) >> 16 )
 
 #define ROUND_F26DOT6( x )     ( x >= 0 ? (    ( (x) + 32 ) & -64 )     \
                                         : ( -( ( 32 - (x) ) & -64 ) ) )
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -213,10 +213,6 @@
   }
 
 
-#define FT_INT_TO_FIXED( a )  ( (a) << 16 )
-#define FT_FIXED_TO_INT( a )  ( FT_RoundFix( a ) >> 16 )
-
-
   /*************************************************************************/
   /*                                                                       */
   /* Given a normalized (blend) coordinate, figure out the design          */
@@ -230,7 +226,7 @@
 
 
     if ( ncv <= axismap->blend_points[0] )
-      return FT_INT_TO_FIXED( axismap->design_points[0] );
+      return INT_TO_FIXED( axismap->design_points[0] );
 
     for ( j = 1; j < axismap->num_points; ++j )
     {
@@ -241,7 +237,7 @@
                                  axismap->blend_points[j] -
                                    axismap->blend_points[j - 1] );
 
-        return FT_INT_TO_FIXED( axismap->design_points[j - 1] ) +
+        return INT_TO_FIXED( axismap->design_points[j - 1] ) +
                  FT_MulDiv( t,
                             axismap->design_points[j] -
                               axismap->design_points[j - 1],
@@ -249,7 +245,7 @@
       }
     }
 
-    return FT_INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] );
+    return INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] );
   }
 
 
@@ -331,8 +327,8 @@
     for ( i = 0 ; i < mmaster.num_axis; ++i )
     {
       mmvar->axis[i].name    = mmaster.axis[i].name;
-      mmvar->axis[i].minimum = FT_INT_TO_FIXED( mmaster.axis[i].minimum);
-      mmvar->axis[i].maximum = FT_INT_TO_FIXED( mmaster.axis[i].maximum);
+      mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum);
+      mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum);
       mmvar->axis[i].def     = ( mmvar->axis[i].minimum +
                                    mmvar->axis[i].maximum ) / 2;
                             /* Does not apply.  But this value is in range */
@@ -502,7 +498,7 @@
      if ( num_coords <= 4 && num_coords > 0 )
      {
        for ( i = 0; i < num_coords; ++i )
-         lcoords[i] = FT_FIXED_TO_INT( coords[i] );
+         lcoords[i] = FIXED_TO_INT( coords[i] );
        error = T1_Set_MM_Design( face, num_coords, lcoords );
      }