shithub: freetype+ttf2subf

Download patch

ref: 6cfbb23ca3665b52357119444a4ba2abd6e489fc
parent: e7d1fb3142b5e79b83a6267e1a838341b05fc154
author: Werner Lemberg <[email protected]>
date: Sat Feb 26 12:32:38 EST 2011

[autofit] Some comments.  Whitespace.

git/fs: mount .git/fs: mount/attach disallowed
--- a/src/autofit/aflatin.h
+++ b/src/autofit/aflatin.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter hinting routines for latin script (specification).       */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2006, 2007, 2009 by                        */
+/*  Copyright 2003-2007, 2009, 2011 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -30,8 +30,8 @@
   AF_DECLARE_SCRIPT_CLASS(af_latin_script_class)
 
 
-/* constants are given with units_per_em == 2048 in mind */
-#define AF_LATIN_CONSTANT( metrics, c ) \
+  /* constants are given with units_per_em == 2048 in mind */
+#define AF_LATIN_CONSTANT( metrics, c )                                      \
   ( ( (c) * (FT_Long)( (AF_LatinMetrics)(metrics) )->units_per_em ) / 2048 )
 
 
@@ -76,10 +76,10 @@
 
   enum
   {
-    AF_LATIN_BLUE_ACTIVE     = 1 << 0,
-    AF_LATIN_BLUE_TOP        = 1 << 1,
-    AF_LATIN_BLUE_ADJUSTMENT = 1 << 2,  /* used for scale adjustment */
-                                        /* optimization              */
+    AF_LATIN_BLUE_ACTIVE     = 1 << 0,  /* set if zone height is <= 3/4px */
+    AF_LATIN_BLUE_TOP        = 1 << 1,  /* result of AF_LATIN_IS_TOP_BLUE */
+    AF_LATIN_BLUE_ADJUSTMENT = 1 << 2,  /* used for scale adjustment      */
+                                        /* optimization                   */
     AF_LATIN_BLUE_FLAG_MAX
   };
 
@@ -98,11 +98,11 @@
     FT_Fixed         scale;
     FT_Pos           delta;
 
-    FT_UInt          width_count;
-    AF_WidthRec      widths[AF_LATIN_MAX_WIDTHS];
-    FT_Pos           edge_distance_threshold;
-    FT_Pos           standard_width;
-    FT_Bool          extra_light;
+    FT_UInt          width_count;                 /* number of used widths */
+    AF_WidthRec      widths[AF_LATIN_MAX_WIDTHS]; /* widths array          */
+    FT_Pos           edge_distance_threshold;   /* used for creating edges */
+    FT_Pos           standard_width;         /* the default stem thickness */
+    FT_Bool          extra_light;         /* is standard width very light? */
 
     /* ignored for horizontal metrics */
     FT_Bool          control_overshoot;
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter glyph loading routines (body).                           */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by                  */
+/*  Copyright 2003-2009, 2011 by                                           */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -22,6 +22,8 @@
 #include "aferrors.h"
 
 
+  /* Initialize glyph loader. */
+
   FT_LOCAL_DEF( FT_Error )
   af_loader_init( AF_Loader  loader,
                   FT_Memory  memory )
@@ -36,6 +38,8 @@
   }
 
 
+  /* Reset glyph loader and compute globals if necessary. */
+
   FT_LOCAL_DEF( FT_Error )
   af_loader_reset( AF_Loader  loader,
                    FT_Face    face )
@@ -64,6 +68,8 @@
   }
 
 
+  /* Finalize glyph loader. */
+
   FT_LOCAL_DEF( void )
   af_loader_done( AF_Loader  loader )
   {
@@ -80,6 +86,10 @@
   }
 
 
+  /* Load a single glyph component.  This routine calls itself */
+  /* recursively, if necessary, and does the main work of      */
+  /* `af_loader_load_glyph.'                                   */
+
   static FT_Error
   af_loader_load_g( AF_Loader  loader,
                     AF_Scaler  scaler,
@@ -169,8 +179,8 @@
                                             &gloader->current.outline,
                                             metrics );
 
-      /* we now need to hint the metrics according to the change in */
-      /* width/positioning that occurred during the hinting process */
+      /* we now need to adjust the metrics according to the change in */
+      /* width/positioning that occurred during the hinting process   */
       if ( scaler->render_mode != FT_RENDER_MODE_LIGHT )
       {
         FT_Pos        old_rsb, old_lsb, new_lsb;
@@ -265,7 +275,7 @@
         gloader->current.num_subglyphs = num_subglyphs;
         num_base_subgs                 = gloader->base.num_subglyphs;
 
-        /* now, read each subglyph independently */
+        /* now read each subglyph independently */
         for ( nn = 0; nn < num_subglyphs; nn++ )
         {
           FT_Vector  pp1, pp2;
@@ -305,7 +315,7 @@
           num_points     = gloader->base.outline.n_points;
           num_new_points = num_points - num_base_points;
 
-          /* now perform the transform required for this subglyph */
+          /* now perform the transformation required for this subglyph */
 
           if ( subglyph->flags & ( FT_SUBGLYPH_FLAG_SCALE    |
                                    FT_SUBGLYPH_FLAG_XY_SCALE |
@@ -444,7 +454,7 @@
 #endif
 
       slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance,
-                                              metrics->scaler.y_scale );
+                                             metrics->scaler.y_scale );
 
       slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance );
       slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance );
@@ -467,6 +477,8 @@
     return error;
   }
 
+
+  /* Load a glyph. */
 
   FT_LOCAL_DEF( FT_Error )
   af_loader_load_glyph( AF_Loader  loader,
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter module implementation (body).                            */
 /*                                                                         */
-/*  Copyright 2003, 2004, 2005, 2006 by                                    */
+/*  Copyright 2003-2006, 2009, 2011 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -67,14 +67,15 @@
   }
 
 
-  FT_DEFINE_AUTOHINTER_SERVICE(af_autofitter_service,
+  FT_DEFINE_AUTOHINTER_SERVICE(
+    af_autofitter_service,
     NULL,
     NULL,
     NULL,
-    (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph
-  )
+    (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph )
 
-  FT_DEFINE_MODULE(autofit_module_class,
+  FT_DEFINE_MODULE(
+    autofit_module_class,
 
     FT_MODULE_HINTER,
     sizeof ( FT_AutofitterRec ),
@@ -87,8 +88,7 @@
 
     (FT_Module_Constructor)af_autofitter_init,
     (FT_Module_Destructor) af_autofitter_done,
-    (FT_Module_Requester)  NULL
-  )
+    (FT_Module_Requester)  NULL )
 
 
 /* END */