Commit 1723dcc26169d4fecd8a85476421b2d18c8f8748

Werner Lemberg 2006-01-15T07:30:32

Formatting, minor clean-ups.

diff --git a/ChangeLog b/ChangeLog
index 29f26c9..76236b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,31 +1,34 @@
 2006-01-15  Chia-I Wu  <b90201047@ntu.edu.tw>
 
 	* include/freetype/internal/ftobjs.h (ft_fake_vertical_metrics),
-	src/base/ftobjs.c (ft_fake_vertical_metrics): New function to fake the
+	src/base/ftobjs.c (ft_fake_vertical_metrics): New function to fake
 	vertical metrics.
 
 	* src/cff/cffgload.c, src/cid/cidgload.c, src/pcf/pcfdrivr.c,
-	src/type1/t1gload.c, src/winfonts/winfnt.c: Fake the vertical metrics.
-	The fake metrics is monotone.
+	src/type1/t1gload.c, src/winfonts/winfnt.c: Fake vertical metrics,
+	which are monotone.
 
 	* src/truetype/ttgload.c (compute_glyph_metrics): Some fixes and
-	formattings in vertical metrics faking.  There are still rooms for
-	improvements (and so do the CFF module).
+	formattings in vertical metrics faking.  There is still room for
+	improvements (and so does the CFF module).
 
 2006-01-15  Chia-I Wu  <b90201047@ntu.edu.tw>
 
 	* src/bdf/bdfdrivr.c (BDF_Glyph_Load), src/pcf/pcfdrivr.c
 	(PCF_Glyph_Load), src/winfonts/winfnt.c (FNT_Load_Glyph): Don't set
-	the linear advance fields as they are only for the outline glyphs.
+	the linear advance fields as they are only used by the outline
+	glyphs.
 
-	* include/freetype/freetype.h: Documentation updates/clarificatoins.
+	* include/freetype/freetype.h: Documentation updates and
+	clarifications.
 	The meaning of FT_LOAD_FORCE_AUTOHINT is changed so that no real
 	change need be made to the code.
 
 	* src/base/ftobjs.c (FT_Load_Glyph): Resolve flag dependencies and
 	decide whether to use the auto-hinter according to documentation.
 	There should to be no real difference.
-	Some checks (e.g., is text height positve?) after the glyph is loaded.
+	Some checks (e.g., is text height positve?) after the glyph is
+	loaded.
 	(FT_Select_Size, FT_Request_Size): Scales are set to wrong values.
 	Be careful that scales won't be negative.
 
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 017dc8f..401d669 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1238,16 +1238,16 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    y_ppem       :: The height of the scaled EM square in pixels,      */
   /*                    hence the term `ppem' (pixels per EM).  It is also */
-  /*                    refeered to as `nominal height'.                   */
+  /*                    referred to as `nominal height'.                   */
   /*                                                                       */
   /*    x_scale      :: A 16.16 fractional scale used to convert           */
   /*                    horizontal metrics from font units to 26.6         */
   /*                    fractional pixels.  Only relevant for scalable     */
-  /*                    formats.                                           */
+  /*                    font formats.                                      */
   /*                                                                       */
   /*    y_scale      :: A 16.16 fractional scale used to convert vertical  */
   /*                    metrics from font units to 26.6 fractional pixels. */
-  /*                    Only relevant for scalable formats.                */
+  /*                    Only relevant for scalable font formats.           */
   /*                                                                       */
   /*    ascender     :: The ascender in 26.6 fractional pixels.  See       */
   /*                    @FT_FaceRec for the details.                       */
@@ -1263,9 +1263,9 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /* <Note>                                                                */
   /*    The scales, if relevant, are determined first during a size        */
-  /*    changing operation.  The reset fields are then set by the driver.  */
-  /*    For scalable formats, they are usually set to scaled values of the */
-  /*    corresponding fields in @FT_FaceRec.                               */
+  /*    changing operation.  The remaining fields are then set by the      */
+  /*    driver.  For scalable formats, they are usually set to scaled      */
+  /*    values of the corresponding fields in @FT_FaceRec.                 */
   /*                                                                       */
   /*    Note that due to glyph hinting, these values might not be exact    */
   /*    for certain fonts.  Thus they must be treated as unreliable        */
@@ -2432,8 +2432,8 @@ FT_BEGIN_HEADER
    *   `load_flags'.  They can't be ORed.
    *
    *   If @FT_LOAD_RENDER is also set, the glyph is rendered in the
-   *   corresponding mode (i.e., the mode best matching the algorithm used)
-   *   unless @FT_LOAD_MONOCHROME is set.
+   *   corresponding mode (i.e., the mode which matches the used algorithm
+   *   best) unless @FT_LOAD_MONOCHROME is set.
    *
    *   You can use a hinting algorithm that doesn't correspond to the same
    *   rendering mode.  As an example, it is possible to use the `light'
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 34b1f95..4001a48 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -520,12 +520,12 @@
       load_flags |= FT_LOAD_FORCE_AUTOHINT;
 
     /* auto-hinter is preferred and should be used */
-    if ( ( !FT_DRIVER_HAS_HINTER( driver )           ||
+    if ( ( !FT_DRIVER_HAS_HINTER( driver )         ||
            ( load_flags & FT_LOAD_FORCE_AUTOHINT ) ) &&
          !( load_flags & FT_LOAD_NO_HINTING )        &&
-         !( load_flags & FT_LOAD_NO_AUTOHINT ) )
+         !( load_flags & FT_LOAD_NO_AUTOHINT )       )
     {
-      /* check if it works for this face */
+      /* check whether it works for this face */
       autohint =
         FT_BOOL( hinter                                   &&
                  FT_DRIVER_IS_SCALABLE( driver )          &&
@@ -1729,7 +1729,7 @@
 
     if ( FT_HAS_FIXED_SIZES( face ) )
     {
-      FT_Int           i;
+      FT_Int  i;
 
       
       for ( i = 0; i < face->num_fixed_sizes; i++ )
@@ -2045,6 +2045,7 @@
   ft_fake_vertical_metrics( FT_Glyph_Metrics*  metrics,
                             FT_Pos             advance )
   {
+    /* the factor 1.2 is a heuristical value */
     if ( !advance )
       advance = metrics->height * 12 / 10;
 
@@ -2110,8 +2111,8 @@
     }
     else
     {
-      metrics->x_scale     = 1 << 22;
-      metrics->y_scale     = 1 << 22;
+      metrics->x_scale     = 1L << 22;
+      metrics->y_scale     = 1L << 22;
       metrics->ascender    = bsize->y_ppem;
       metrics->descender   = 0;
       metrics->height      = bsize->height << 6;
@@ -2238,8 +2239,8 @@
     else
     {
       FT_ZERO( metrics );
-      metrics->x_scale = 1 << 22;
-      metrics->y_scale = 1 << 22;
+      metrics->x_scale = 1L << 22;
+      metrics->y_scale = 1L << 22;
 
       if ( FT_HAS_FIXED_SIZES( face ) )
         bitmap_only = 1;
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 417eb4d..f66fe24 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -2610,9 +2610,9 @@
         glyph->root.linearHoriAdvance           = decoder.glyph_width;
         glyph->root.internal->glyph_transformed = 0;
 
-        has_vertical_info = ( face->vertical_info                   &&
-                              face->vertical.number_Of_VMetrics > 0 &&
-                              face->vertical.long_metrics != 0      );
+        has_vertical_info = face->vertical_info                   &&
+                            face->vertical.number_Of_VMetrics > 0 &&
+                            face->vertical.long_metrics != 0;
 
         /* get the vertical metrics from the vtmx table if we have one */
         if ( has_vertical_info )
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index c0fec67..dc3429a 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -343,8 +343,8 @@
         cidglyph->internal->glyph_transformed = 0;
 
         /* make up vertical ones */
-        metrics->vertAdvance = ( face->cid.font_bbox.yMax -
-                                 face->cid.font_bbox.yMin ) >> 16;
+        metrics->vertAdvance        = ( face->cid.font_bbox.yMax -
+                                        face->cid.font_bbox.yMin ) >> 16;
         cidglyph->linearVertAdvance = metrics->vertAdvance;
 
         cidglyph->format            = FT_GLYPH_FORMAT_OUTLINE;
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 6b28c7d..feca624 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1673,8 +1673,8 @@
     /* up some metrics by `hand'...                                      */
 
     {
-      FT_Pos     top;      /* scaled vertical top side bearing  */
-      FT_Pos     advance;  /* scaled vertical advance height    */
+      FT_Pos  top;      /* scaled vertical top side bearing  */
+      FT_Pos  advance;  /* scaled vertical advance height    */
 
 
       /* Get the unscaled top bearing and advance height. */
@@ -1731,6 +1731,7 @@
           metrics.bearing_x = 0;
           metrics.bearing_y = top;
           metrics.advance   = advance;
+
           error = incr->funcs->get_glyph_metrics( incr->object,
                                                   glyph_index,
                                                   TRUE,