shithub: freetype+ttf2subf

Download patch

ref: 25f845aa64d720052c92d6f524af7d8eae13db27
parent: 00d9f40cf7ec068286792eb352971cd7ed53fc73
author: David Turner <[email protected]>
date: Mon Sep 9 19:45:29 EDT 2002

* src/cache/ftccache.i: fixed a bug that prevented compilation in
        debug mode of template instantiation

        * src/cff/cffparse.c: fixed the CFF table loader. It didn't accept
        empty arrays, and this prevented the loading of certain fonts.

        * src/pshinter/pshalgo2.c, src/pshinter/pshalgo3.c: adding fix to
        prevent seg fault when hints are provided in an empty glyph !!

        * include/freetype/ftimage.h: removed incorrect "zft_" definitions
        and updated constants documentation comments

        * include/freetype/freetype.h (FT_FaceRec): updating documentation
        comment. The "descender" value is always *negative*, not positive !

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2002-09-09  David Turner  <[email protected]>
+
+        * src/cache/ftccache.i: fixed a bug that prevented compilation in
+        debug mode of template instantiation
+
+        * src/cff/cffparse.c: fixed the CFF table loader. It didn't accept
+        empty arrays, and this prevented the loading of certain fonts.
+
+        * src/pshinter/pshalgo2.c, src/pshinter/pshalgo3.c: adding fix to
+        prevent seg fault when hints are provided in an empty glyph !!
+
+2002-09-09  Owen Taylor  <[email protected]>
+
+        * src/pcf/pcfdriver.c (PCF_Glyph_Load): fixing incorrect computation
+        of bitmap metrics.
+
 2002-09-08  David Turner  <[email protected]>
 
         * src/smooth/ftsmooth.c, src/base/ftobjs.c,
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -746,9 +746,9 @@
   /*    descender           :: The face's descender is the vertical        */
   /*                           distance from the baseline to the           */
   /*                           bottommost point of any glyph in the face.  */
-  /*                           This field's value is positive, expressed   */
+  /*                           This field's value is *negative*, expressed */
   /*                           in font units.  Some font designs use a     */
-  /*                           value different from `-bbox.yMin'.  Only    */
+  /*                           value different from `bbox.yMin'.  Only     */
   /*                           relevant for scalable formats.              */
   /*                                                                       */
   /*    height              :: The face's height is the vertical distance  */
--- a/include/freetype/ftimage.h
+++ b/include/freetype/ftimage.h
@@ -422,25 +422,25 @@
   /*************************************************************************/
   /*                                                                       */
   /* <Const>                                                               */
-  /*    FT_OUTLINE_NONE                                                    */
+  /*    ft_outline_none                                                    */
   /*                                                                       */
   /* <Description>                                                         */
   /*    This constant is deprecated.  Please use @FT_OUTLINE_NONE          */
   /*    instead.                                                           */
   /*                                                                       */
-#define zft_outline_none  FT_OUTLINE_NONE
+#define ft_outline_none  FT_OUTLINE_NONE
 
 
   /*************************************************************************/
   /*                                                                       */
   /* <Const>                                                               */
-  /*    FT_OUTLINE_OWNER                                                   */
+  /*    ft_outline_owner                                                   */
   /*                                                                       */
   /* <Description>                                                         */
   /*    This constant is deprecated.  Please use @FT_OUTLINE_OWNER         */
   /*    instead.                                                           */
   /*                                                                       */
-#define zft_outline_owner  FT_OUTLINE_OWNER
+#define ft_outline_owner  FT_OUTLINE_OWNER
 
 
   /*************************************************************************/
@@ -452,55 +452,55 @@
   /*    This constant is deprecated.  Please use @FT_OUTLINE_EVEN_ODD_FILL */
   /*    instead.                                                           */
   /*                                                                       */
-#define zft_outline_even_off_fill  FT_OUTLINE_EVEN_ODD_FILL
+#define ft_outline_even_off_fill  FT_OUTLINE_EVEN_ODD_FILL
 
 
   /*************************************************************************/
   /*                                                                       */
   /* <Const>                                                               */
-  /*    FT_OUTLINE_REVERSE_FILL                                            */
+  /*    ft_outline_reverse_fill                                            */
   /*                                                                       */
   /* <Description>                                                         */
   /*    This constant is deprecated.  Please use @FT_OUTLINE_REVERSE_FILL  */
   /*    instead.                                                           */
   /*                                                                       */
-#define zft_outline_reverse_fill  FT_OUTLINE_REVERSE_FILL
+#define ft_outline_reverse_fill  FT_OUTLINE_REVERSE_FILL
 
 
   /*************************************************************************/
   /*                                                                       */
   /* <Const>                                                               */
-  /*    FT_OUTLINE_IGNORE_DROPOUTS                                         */
+  /*    ft_outline_ignore_dropouts                                         */
   /*                                                                       */
   /* <Description>                                                         */
   /*    This constant is deprecated.  Please use                           */
   /*    @FT_OUTLINE_IGNORE_DROPOUTS instead.                               */
   /*                                                                       */
-#define zft_outline_ignore_dropouts  FT_OUTLINE_IGNORE_DROPOUTS
+#define ft_outline_ignore_dropouts  FT_OUTLINE_IGNORE_DROPOUTS
 
 
   /*************************************************************************/
   /*                                                                       */
   /* <Const>                                                               */
-  /*    FT_OUTLINE_HIGH_PRECISION                                          */
+  /*    ft_outline_high_precision                                          */
   /*                                                                       */
   /* <Description>                                                         */
   /*    This constant is deprecated.  Please use                           */
   /*    @FT_OUTLINE_HIGH_PRECISION instead.                                */
   /*                                                                       */
-#define zft_outline_high_precision  FT_OUTLINE_HIGH_PRECISION
+#define ft_outline_high_precision  FT_OUTLINE_HIGH_PRECISION
 
 
   /*************************************************************************/
   /*                                                                       */
   /* <Const>                                                               */
-  /*    FT_OUTLINE_SINGLE_PASS                                             */
+  /*    ft_outline_single_pass                                             */
   /*                                                                       */
   /* <Description>                                                         */
   /*    This constant is deprecated.  Please use @FT_OUTLINE_SINGLE_PASS   */
   /*    instead.                                                           */
   /*                                                                       */
-#define zft_outline_single_pass  FT_OUTLINE_SINGLE_PASS
+#define ft_outline_single_pass  FT_OUTLINE_SINGLE_PASS
 
   /* */
 
--- a/src/cache/ftccache.i
+++ b/src/cache/ftccache.i
@@ -89,16 +89,6 @@
         bucket  = cache->buckets + idx;
       }
 
-#ifdef FT_DEBUG_LEVEL_ERROR
-      if ( query->family     != family                        ||
-           family->fam_index >= cache->manager->families.size )
-      {
-        FT_ERROR((
-          "ftc_cache_lookup: invalid query (bad 'family' field)\n" ));
-        return FTC_Err_Invalid_Argument;
-      }
-#endif
-
       pnode = bucket;
 
       for ( ;; )
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -542,10 +542,6 @@
         const CFF_Field_Handler*  field;
 
 
-        /* first of all, a trivial check */
-        if ( num_args < 1 )
-          goto Stack_Underflow;
-
         *parser->top = p;
         code = v;
         if ( v == 12 )
@@ -552,6 +548,9 @@
         {
           /* two byte operator */
           p++;
+          if ( p >= limit )
+            goto Syntax_Error;
+
           code = 0x100 | p[0];
         }
         code = code | parser->object_code;
@@ -564,6 +563,11 @@
             FT_Long   val;
             FT_Byte*  q = (FT_Byte*)parser->object + field->offset;
 
+
+            /* check that we have enough arguments -- except for */
+            /* delta encoded arrays, which can be empty          */
+            if ( field->kind != cff_kind_delta && num_args < 1 )
+              goto Stack_Underflow;
 
             switch ( field->kind )
             {
--- a/src/pcf/pcfdriver.c
+++ b/src/pcf/pcfdriver.c
@@ -414,7 +414,8 @@
     slot->metrics.horiAdvance  = metric->characterWidth << 6 ;
     slot->metrics.horiBearingX = metric->leftSideBearing << 6 ;
     slot->metrics.horiBearingY = metric->ascent << 6 ;
-    slot->metrics.width        = metric->characterWidth << 6 ;
+    slot->metrics.width        = ( metric->rightSideBearing -
+                                   metric->leftSideBearing ) << 6;
     slot->metrics.height       = bitmap->rows << 6;
 
     slot->linearHoriAdvance = (FT_Fixed)bitmap->width << 16;
--- a/src/pshinter/pshalgo2.c
+++ b/src/pshinter/pshalgo2.c
@@ -1128,7 +1128,7 @@
 
 
       /* process secondary hints to "selected" points */
-      if ( num_masks > 1 )
+      if ( num_masks > 1 && glyph->num_points > 0 )
       {
         first = mask->end_point;
         mask++;
--- a/src/pshinter/pshalgo3.c
+++ b/src/pshinter/pshalgo3.c
@@ -1297,7 +1297,7 @@
 
 
       /* process secondary hints to "selected" points */
-      if ( num_masks > 1 )
+      if ( num_masks > 1 && glyph->num_points > 0 )
       {
         first = mask->end_point;
         mask++;
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -720,7 +720,7 @@
       sbit_metrics->y_scale     = 1 << 16;
 #endif
 
-      sbit_metrics->ascender    = strike->hori.ascender << 6;
+      sbit_metrics->ascender    = strike->hori.ascender  << 6;
       sbit_metrics->descender   = strike->hori.descender << 6;
 
       /* XXX: Is this correct? */