shithub: freetype+ttf2subf

Download patch

ref: 5220ef58c5ac065bd388c6ae7685e661b8e8bc78
parent: fd0cdb7b9e9a9bc19c710a601c3fd870e026304b
author: Werner Lemberg <[email protected]>
date: Mon Sep 13 03:32:22 EDT 2010

Fix minor issues reported by <[email protected]>.

* src/autofit/aflatin.c (af_latin_compute_stem_width): Remove
redundant conditional check.
* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Ditto.
* src/cff/cffload.c (cff_encoding_load): Remove conditional check
which always evaluates to `true'.
* src/pshinter/pshalgo.c (ps_glyph_interpolate_strong_points):
Ditto.
* src/truetype/ttinterp.c (Ins_IUP): Ditto.
* src/cid/cidgload.c (cid_slot_load_glyph): Don't check for NULL if
value is already dereferenced.
* src/winfonts/winfnt.c (FNT_Load_Glyph): Fix check of `face'.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2010-09-13  Werner Lemberg  <[email protected]>
+
+	Fix minor issues reported by <[email protected]>.
+
+	* src/autofit/aflatin.c (af_latin_compute_stem_width): Remove
+	redundant conditional check.
+	* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Ditto.
+	* src/cff/cffload.c (cff_encoding_load): Remove conditional check
+	which always evaluates to `true'.
+	* src/pshinter/pshalgo.c (ps_glyph_interpolate_strong_points):
+	Ditto.
+	* src/truetype/ttinterp.c (Ins_IUP): Ditto.
+	* src/cid/cidgload.c (cid_slot_load_glyph): Don't check for NULL if
+	value is already dereferenced.
+	* src/winfonts/winfnt.c (FNT_Load_Glyph): Fix check of `face'.
+
 2010-08-31  suzuki toshiya  <[email protected]>
 
 	Ignore the environmental setting of LIBTOOL.
@@ -31,7 +47,7 @@
 	them in later interpretation is danger.  By unsetting these flags,
 	`fpgm' and `prep' tables are executed again in next interpretation.
 
-	Fix Savannah bug #30798, reported by Robert Swiecki.
+	This fixes Savannah bug #30798, reported by Robert Święcki.
 
 2010-08-29  Werner Lemberg  <[email protected]>
 
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -1534,21 +1534,18 @@
 
 
         /* compare to standard width */
-        if ( axis->width_count > 0 )
-        {
-          delta = dist - axis->widths[0].cur;
+        delta = dist - axis->widths[0].cur;
 
-          if ( delta < 0 )
-            delta = -delta;
+        if ( delta < 0 )
+          delta = -delta;
 
-          if ( delta < 40 )
-          {
-            dist = axis->widths[0].cur;
-            if ( dist < 48 )
-              dist = 48;
+        if ( delta < 40 )
+        {
+          dist = axis->widths[0].cur;
+          if ( dist < 48 )
+            dist = 48;
 
-            goto Done_Width;
-          }
+          goto Done_Width;
         }
 
         if ( dist < 3 * 64 )
--- a/src/base/ftsynth.c
+++ b/src/base/ftsynth.c
@@ -90,7 +90,7 @@
 
 
     if ( slot->format != FT_GLYPH_FORMAT_OUTLINE &&
-         slot->format != FT_GLYPH_FORMAT_BITMAP )
+         slot->format != FT_GLYPH_FORMAT_BITMAP  )
       return;
 
     /* some reasonable strength */
@@ -108,7 +108,7 @@
       xstr = xstr * 2;
       ystr = xstr;
     }
-    else if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
+    else /* slot->format == FT_GLYPH_FORMAT_BITMAP */
     {
       /* round to full pixels */
       xstr &= ~63;
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1255,9 +1255,7 @@
           if ( gid != 0 )
           {
             encoding->codes[j] = (FT_UShort)gid;
-
-            if ( encoding->count < j + 1 )
-              encoding->count = j + 1;
+            encoding->count    = j + 1;
           }
           else
           {
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -272,7 +272,6 @@
                        FT_Int32      load_flags )
   {
     CID_GlyphSlot  glyph = (CID_GlyphSlot)cidglyph;
-    CID_Size       size  = (CID_Size)cidsize;
     FT_Error       error;
     T1_DecoderRec  decoder;
     CID_Face       face = (CID_Face)cidglyph->face;
@@ -375,7 +374,7 @@
 
       cidglyph->format            = FT_GLYPH_FORMAT_OUTLINE;
 
-      if ( size && cidsize->metrics.y_ppem < 24 )
+      if ( cidsize->metrics.y_ppem < 24 )
         cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
 
       /* apply the font matrix */
--- a/src/pshinter/pshalgo.c
+++ b/src/pshinter/pshalgo.c
@@ -1862,12 +1862,10 @@
             point->cur_u = hint->cur_pos + hint->cur_len +
                              FT_MulFix( delta - hint->org_len, scale );
 
-          else if ( hint->org_len > 0 )
+          else /* hint->org_len > 0 */
             point->cur_u = hint->cur_pos +
                              FT_MulDiv( delta, hint->cur_len,
                                         hint->org_len );
-          else
-            point->cur_u = hint->cur_pos;
         }
         psh_point_set_fitted( point );
       }
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -6773,12 +6773,11 @@
         {
           if ( ( CUR.pts.tags[point] & mask ) != 0 )
           {
-            if ( point > 0 )
-              _iup_worker_interpolate( &V,
-                                       cur_touched + 1,
-                                       point - 1,
-                                       cur_touched,
-                                       point );
+            _iup_worker_interpolate( &V,
+                                     cur_touched + 1,
+                                     point - 1,
+                                     cur_touched,
+                                     point );
             cur_touched = point;
           }
 
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType font driver for Windows FNT/FON files                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by       */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*  Copyright 2003 Huw D M Davies for Codeweavers                          */
 /*  Copyright 2007 Dmitry Timoshkov for Codeweavers                        */
@@ -944,7 +944,7 @@
                   FT_Int32      load_flags )
   {
     FNT_Face    face   = (FNT_Face)FT_SIZE_FACE( size );
-    FNT_Font    font   = face->font;
+    FNT_Font    font;
     FT_Error    error  = FNT_Err_Ok;
     FT_Byte*    p;
     FT_Int      len;
@@ -955,7 +955,15 @@
     FT_UNUSED( load_flags );
 
 
-    if ( !face || !font ||
+    if ( !face )
+    {
+      error = FNT_Err_Invalid_Argument;
+      goto Exit;
+    }
+
+    font = face->font;
+
+    if ( !font ||
          glyph_index >= (FT_UInt)( FT_FACE( face )->num_glyphs ) )
     {
       error = FNT_Err_Invalid_Argument;