Commit de5e686661326bfef3f78697f4e1f2aabd38bc48

Werner Lemberg 2007-02-25T21:06:43

formatting

diff --git a/ChangeLog b/ChangeLog
index 5adb4e5..8b3631b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
 2007-02-21  David Turner  <david@freetype.org>
 
-	* src/pshinter/pshalgo.c: fixed a bug in the hinting of small
-	and ghost stems in the Postscript interpreter
+	* src/pshinter/pshalgo.c (psh_hint_align): Fix a bug in the hinting
+	of small and ghost stems in the Postscript interpreter.
 
 2007-02-20  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
 
diff --git a/builds/mac/ftmac.c b/builds/mac/ftmac.c
index d6a8558..45365dc 100644
--- a/builds/mac/ftmac.c
+++ b/builds/mac/ftmac.c
@@ -283,7 +283,7 @@
                                              kCFStringEncodingMacRoman );
     ats_font_id = ATSFontFindFromName( cf_fontName,
                                        kATSOptionFlagsUnRestrictedScope );
-    CFRelease(cf_fontName);
+    CFRelease( cf_fontName );
 
     if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL )
       return FT_Err_Unknown_File_Format;
diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c
index a01ca2a..a22b80f 100644
--- a/src/pshinter/pshalgo.c
+++ b/src/pshinter/pshalgo.c
@@ -543,53 +543,57 @@
               /* the stem is less than one pixel; we will center it
                * around the nearest pixel center
                */
-              if (len >= 32) 
+              if ( len >= 32 )
               {
-                 /* this is a special case where we also widen the stem
-                  * and align it to the pixel grid.
-                  *
-                  *   stem_center          = pos + (len/2)
-                  *   nearest_pixel_center = FT_ROUND(stem_center-32)+32
-                  *   new_pos              = nearest_pixel_center-32
-                  *                        = FT_ROUND(stem_center-32)
-                  *                        = FT_FLOOR(stem_center-32+32)
-                  *                        = FT_FLOOR(stem_center)
-                  *   new_len              = 64
-                  */
-                  pos = FT_PIX_FLOOR( pos + (len >> 1) );
-                  len = 64;
+                /* This is a special case where we also widen the stem
+                 * and align it to the pixel grid.
+                 *
+                 *   stem_center          = pos + (len/2)
+                 *   nearest_pixel_center = FT_ROUND(stem_center-32)+32
+                 *   new_pos              = nearest_pixel_center-32
+                 *                        = FT_ROUND(stem_center-32)
+                 *                        = FT_FLOOR(stem_center-32+32)
+                 *                        = FT_FLOOR(stem_center)
+                 *   new_len              = 64
+                 */
+                pos = FT_PIX_FLOOR( pos + ( len >> 1 ) );
+                len = 64;
               }
-              else if (len > 0)
+              else if ( len > 0 )
               {
-                 /* this is a very small stem, we simply align it to the
-                  * pixel grid, trying to find the minimal displacement
-                  *
-                  * left               = pos
-                  * right              = pos + len
-                  * left_nearest_edge  = ROUND(pos)
-                  * right_nearest_edge = ROUND(right)
-                  * 
-                  * if ( ABS(left_nearest_edge - left) <= ABS(right_nearest_edge - right)
-                  *    new_pos = left
-                  * else
-                  *    new_pos = right
-                  */
-                  FT_Pos  left_nearest  = FT_PIX_ROUND(pos);
-                  FT_Pos  right_nearest = FT_PIX_ROUND(pos+len);
-                  FT_Pos  left_disp     = left_nearest - pos;
-                  FT_Pos  right_disp    = right_nearest - (pos+len);
-
-                  if (left_disp  < 0) left_disp  = -left_disp;
-                  if (right_disp < 0) right_disp = -right_disp;
-                  if (left_disp <= right_disp)
-                      pos = left_nearest;
-                  else
-                      pos = right_nearest;
+                /* This is a very small stem; we simply align it to the
+                 * pixel grid, trying to find the minimal displacement.
+                 *
+                 * left               = pos
+                 * right              = pos + len
+                 * left_nearest_edge  = ROUND(pos)
+                 * right_nearest_edge = ROUND(right)
+                 *
+                 * if ( ABS(left_nearest_edge - left) <=
+                 *      ABS(right_nearest_edge - right) )
+                 *    new_pos = left
+                 * else
+                 *    new_pos = right
+                 */
+                FT_Pos  left_nearest  = FT_PIX_ROUND( pos );
+                FT_Pos  right_nearest = FT_PIX_ROUND( pos + len );
+                FT_Pos  left_disp     = left_nearest - pos;
+                FT_Pos  right_disp    = right_nearest - ( pos + len );
+
+
+                if ( left_disp < 0 )
+                  left_disp = -left_disp;
+                if ( right_disp < 0 )
+                  right_disp = -right_disp;
+                if ( left_disp <= right_disp )
+                  pos = left_nearest;
+                else
+                  pos = right_nearest;
               }
               else
               {
-                  /* this is a ghost stem, we're going to simply round it */
-                  pos = FT_PIX_ROUND( pos );
+                /* this is a ghost stem; we simply round it */
+                pos = FT_PIX_ROUND( pos );
               }
             }
             else