shithub: freetype+ttf2subf

Download patch

ref: 0240d29cac53975d5b7309678c7ae59b35775e54
parent: 858f310b80da8655ba0d30a9551e8fbcc3de4818
author: Werner Lemberg <[email protected]>
date: Mon Jun 9 11:54:18 EDT 2003

* src/gzip/ftgzip.c (ft_gzip_file_fill_output): Handle Z_STREAM_END
correctly.

* src/pshinter/pshglob.c (psh_globals_new): Change calculation of
dim->stdw.count to avoid compiler problem.

* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Move the block
variables to the beginning of the function to avoid compiler
problems.
Add casts necessary for 16bit compilers.

* src/pfr/rules.mk (PFR_DRV_SRC): Add pfrsbit.c.
(PFR_DRV_H): Add pfrtypes.h.

* include/freetype/config/ftconfig.h: s/__MWKS__/__MWERKS__/.

* src/pfr/pfrsbit.c (pfr_bitwriter_init): Change type of third
argument to FT_Bool.
(pfr_lookup_bitmap_data): Change type of third and fourth argument
to FT_UInt.  Updated caller.
(pfr_load_bitmap_bits): Change type of fourth argument to FT_Bool.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2003-06-09  Alexis S. L. Carvalho  <[email protected]>
+
+	* src/gzip/ftgzip.c (ft_gzip_file_fill_output): Handle Z_STREAM_END
+	correctly.
+
+2003-06-09  Wolfgang Domr�se  <[email protected]>
+
+	* src/pshinter/pshglob.c (psh_globals_new): Change calculation of
+	dim->stdw.count to avoid compiler problem.
+
+	* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Move the block
+	variables to the beginning of the function to avoid compiler
+	problems.
+	Add casts necessary for 16bit compilers.
+
+2003-06-09  Werner Lemberg  <[email protected]>
+
+	* src/pfr/rules.mk (PFR_DRV_SRC): Add pfrsbit.c.
+	(PFR_DRV_H): Add pfrtypes.h.
+
+	* include/freetype/config/ftconfig.h: s/__MWKS__/__MWERKS__/.
+
+2003-06-08  Karl Schultz  <[email protected]>
+
+	* src/pfr/pfrsbit.c (pfr_bitwriter_init): Change type of third
+	argument to FT_Bool.
+	(pfr_lookup_bitmap_data): Change type of third and fourth argument
+	to FT_UInt.  Updated caller.
+	(pfr_load_bitmap_bits): Change type of fourth argument to FT_Bool.
+
 2003-06-08  Werner Lemberg  <[email protected]>
 
 	Completely revised FreeType's make management.
@@ -4713,10 +4743,10 @@
 
 2001-12-12  David Turner  <[email protected]>
 
-	* src/pshint/pshglob.c (psh_blues_scale_zones, psh_blues_snap_stem
+	* src/pshinter/pshglob.c (psh_blues_scale_zones, psh_blues_snap_stem
 	psh_globals_new): Adding correct BlueScale/BlueShift support, plus
 	family blues processing.
-	* src/pshint/pshglob.h (PSH_BluesRec): Updated.
+	* src/pshinter/pshglob.h (PSH_BluesRec): Updated.
 
 	Started adding support for the Postscript hinter in the CFF module.
 
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    ANSI-specific configuration file (specification only).               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -178,7 +178,7 @@
 
   /* Watcom doesn't provide 64-bit data types */
 
-#elif defined( __MWKS__ )      /* Metrowerks CodeWarrior */
+#elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */
 
   /* I don't know if it provides 64-bit data types, any suggestion */
   /* is welcome.                                                   */
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -112,7 +112,7 @@
   /*   return an error later when trying to load the glyph).               */
   /*                                                                       */
   /*   It also check that fields that must be a multiple of 2, 4, or 8     */
-  /*   dont' have incorrect values, etc.                                   */
+  /*   don't have incorrect values, etc.                                   */
   /*                                                                       */
   /* FT_VALIDATE_PARANOID ::                                               */
   /*   Only for font debugging.  Checks that a table follows the           */
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -397,7 +397,8 @@
       if ( err == Z_STREAM_END )
       {
         zip->limit = zstream->next_out;
-        error      = FT_Err_Invalid_Stream_Operation;
+        if ( zip->limit == zip->cursor )
+          error = FT_Err_Invalid_Stream_Operation;
         break;
       }
       else if ( err != Z_OK )
--- a/src/pfr/Jamfile
+++ b/src/pfr/Jamfile
@@ -8,7 +8,7 @@
 
   if $(FT2_MULTI)
   {
-    _sources = pfrdrivr  pfrgload  pfrload  pfrobjs pfrcmap pfrsbit ;
+    _sources = pfrdrivr pfrgload pfrload pfrobjs pfrcmap pfrsbit ;
   }
   else
   {
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -49,7 +49,7 @@
   static void
   pfr_bitwriter_init( PFR_BitWriter  writer,
                       FT_Bitmap*     target,
-                      FT_UInt        decreasing )
+                      FT_Bool        decreasing )
   {
     writer->line   = target->buffer;
     writer->pitch  = target->pitch;
@@ -274,8 +274,8 @@
   static void
   pfr_lookup_bitmap_data( FT_Byte*   base,
                           FT_Byte*   limit,
-                          FT_Int     count,
-                          FT_Byte    flags,
+                          FT_UInt    count,
+                          FT_UInt    flags,
                           FT_UInt    char_code,
                           FT_ULong*  found_offset,
                           FT_ULong*  found_size )
@@ -481,7 +481,7 @@
   pfr_load_bitmap_bits( FT_Byte*    p,
                         FT_Byte*    limit,
                         FT_UInt     format,
-                        FT_UInt     decreasing,
+                        FT_Bool     decreasing,
                         FT_Bitmap*  target )
   {
     FT_Error          error = 0;
@@ -583,7 +583,7 @@
       pfr_lookup_bitmap_data( stream->cursor,
                               stream->limit,
                               strike->num_bitmaps,
-                              (FT_Byte)strike->flags,
+                              strike->flags,
                               character->char_code,
                               &gps_offset,
                               &gps_size );
--- a/src/pfr/rules.mk
+++ b/src/pfr/rules.mk
@@ -29,12 +29,14 @@
                $(PFR_DIR)/pfrgload.c \
                $(PFR_DIR)/pfrcmap.c  \
                $(PFR_DIR)/pfrdrivr.c \
+               $(PFR_DIR)/pfrsbit.c  \
                $(PFR_DIR)/pfrobjs.c
 
 # pfr driver headers
 #
 PFR_DRV_H := $(PFR_DRV_SRC:%.c=%.h) \
-             $(PFR_DIR)/pfrerror.h
+             $(PFR_DIR)/pfrerror.h  \
+             $(PFR_DIR)/pfrtypes.h
 
 
 # Pfr driver object(s)
--- a/src/pshinter/pshglob.c
+++ b/src/pshinter/pshglob.c
@@ -644,7 +644,7 @@
           read++;
         }
 
-        dim->stdw.count = write - dim->stdw.widths;
+        dim->stdw.count = priv->num_snap_widths;
       }
 
       /* copy standard heights */
@@ -663,7 +663,7 @@
           read++;
         }
 
-        dim->stdw.count = write - dim->stdw.widths;
+        dim->stdw.count = priv->num_snap_heights;
       }
 
       /* copy blue zones */
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -294,37 +294,40 @@
     FT_Int          n, n_points;
     FT_Int          byte_len   = load->byte_len;
 
+    FT_Byte         *flag, *flag_limit;
+    FT_Byte         c, count;
+    FT_Vector       *vec, *vec_limit;
+    FT_Pos          x;
+    FT_Short        *cont, *cont_limit;
 
+
     /* reading the contours endpoints & number of points */
-    {
-      short*  cur   = gloader->current.outline.contours;
-      short*  limit = cur + n_contours;
+    cont       = gloader->current.outline.contours;
+    cont_limit = cont + n_contours;
 
+    /* check space for contours array + instructions count */
+    byte_len -= 2 * ( n_contours + 1 );
+    if ( byte_len < 0 )
+      goto Invalid_Outline;
 
-      /* check space for contours array + instructions count */
-      byte_len -= 2 * ( n_contours + 1 );
-      if ( byte_len < 0 )
-        goto Invalid_Outline;
+    for ( ; cont < cont_limit; cont++ )
+      cont[0] = FT_GET_USHORT();
 
-      for ( ; cur < limit; cur++ )
-        cur[0] = FT_GET_USHORT();
+    n_points = 0;
+    if ( n_contours > 0 )
+      n_points = cont[-1] + 1;
 
-      n_points = 0;
-      if ( n_contours > 0 )
-        n_points = cur[-1] + 1;
+    error = FT_GlyphLoader_CheckPoints( gloader, n_points + 2, 0 );
+    if ( error )
+      goto Fail;
 
-      error = FT_GlyphLoader_CheckPoints( gloader, n_points + 2, 0 );
-      if ( error )
-        goto Fail;
+    /* we'd better check the contours table right now */
+    outline = &gloader->current.outline;
 
-      /* we'd better check the contours table right now */
-      outline = &gloader->current.outline;
+    for ( cont = outline->contours + 1; cont < cont_limit; cont++ )
+      if ( cont[-1] >= cont[0] )
+        goto Invalid_Outline;
 
-      for ( cur = outline->contours + 1; cur < limit; cur++ )
-        if ( cur[-1] >= cur[0] )
-          goto Invalid_Outline;
-    }
-
     /* reading the bytecode instructions */
     slot->control_len  = 0;
     slot->control_data = 0;
@@ -331,7 +334,7 @@
 
     n_ins = FT_GET_USHORT();
 
-    FT_TRACE5(( "  Instructions size: %d\n", n_ins ));
+    FT_TRACE5(( "  Instructions size: %u\n", n_ins ));
 
     if ( n_ins > face->max_profile.maxSizeOfInstructions )
     {
@@ -340,7 +343,7 @@
       goto Fail;
     }
 
-    byte_len -= n_ins;
+    byte_len -= (FT_Int)n_ins;
     if ( byte_len < 0 )
     {
       FT_TRACE0(( "TT_Load_Simple_Glyph: Instruction count mismatch!\n" ));
@@ -357,112 +360,102 @@
       slot->control_len  = n_ins;
       slot->control_data = load->instructions;
 
-      FT_MEM_COPY( load->instructions, stream->cursor, n_ins );
+      FT_MEM_COPY( load->instructions, stream->cursor, (FT_Long)n_ins );
     }
 
 #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
-    stream->cursor += n_ins;
+    stream->cursor += (FT_Int)n_ins;
 
     /* reading the point tags */
+    flag       = (FT_Byte*)outline->tags;
+    flag_limit = flag + n_points;
+
+    while ( flag < flag_limit )
     {
-      FT_Byte*  flag  = (FT_Byte*)outline->tags;
-      FT_Byte*  limit = flag + n_points;
-      FT_Byte   c, count;
+      if ( --byte_len < 0 )
+        goto Invalid_Outline;
 
-
-      while ( flag < limit )
+      *flag++ = c = FT_GET_BYTE();
+      if ( c & 8 )
       {
         if ( --byte_len < 0 )
           goto Invalid_Outline;
 
-        *flag++ = c = FT_GET_BYTE();
-        if ( c & 8 )
-        {
-          if ( --byte_len < 0 )
-            goto Invalid_Outline;
+        count = FT_GET_BYTE();
+        if ( flag + (FT_Int)count > flag_limit )
+          goto Invalid_Outline;
 
-          count = FT_GET_BYTE();
-          if ( flag + count > limit )
-            goto Invalid_Outline;
-
-          for ( ; count > 0; count-- )
-            *flag++ = c;
-        }
+        for ( ; count > 0; count-- )
+          *flag++ = c;
       }
+    }
 
-      /* check that there is enough room to load the coordinates */
-      for ( flag = (FT_Byte*)outline->tags; flag < limit; flag++ )
-      {
-        if ( *flag & 2 )
-          byte_len -= 1;
-        else if ( ( *flag & 16 ) == 0 )
-          byte_len -= 2;
+    /* check that there is enough room to load the coordinates */
+    for ( flag = (FT_Byte*)outline->tags; flag < flag_limit; flag++ )
+    {
+      if ( *flag & 2 )
+        byte_len -= 1;
+      else if ( ( *flag & 16 ) == 0 )
+        byte_len -= 2;
 
-        if ( *flag & 4 )
-          byte_len -= 1;
-        else if ( ( *flag & 32 ) == 0 )
-          byte_len -= 2;
-      }
-
-      if ( byte_len < 0 )
-        goto Invalid_Outline;
+      if ( *flag & 4 )
+        byte_len -= 1;
+      else if ( ( *flag & 32 ) == 0 )
+        byte_len -= 2;
     }
 
+    if ( byte_len < 0 )
+      goto Invalid_Outline;
+
     /* reading the X coordinates */
 
+    vec       = outline->points;
+    vec_limit = vec + n_points;
+    flag      = (FT_Byte*)outline->tags;
+    x         = 0;
+
+    for ( ; vec < vec_limit; vec++, flag++ )
     {
-      FT_Vector*  vec   = outline->points;
-      FT_Vector*  limit = vec + n_points;
-      FT_Byte*    flag  = (FT_Byte*)outline->tags;
-      FT_Pos      x     = 0;
+      FT_Pos  y = 0;
 
 
-      for ( ; vec < limit; vec++, flag++ )
+      if ( *flag & 2 )
       {
-        FT_Pos  y = 0;
-
-
-        if ( *flag & 2 )
-        {
-          y = FT_GET_BYTE();
-          if ( ( *flag & 16 ) == 0 )
-            y = -y;
-        }
-        else if ( ( *flag & 16 ) == 0 )
-          y = FT_GET_SHORT();
-
-        x     += y;
-        vec->x = x;
+        y = (FT_Pos)FT_GET_BYTE();
+        if ( ( *flag & 16 ) == 0 )
+          y = -y;
       }
+      else if ( ( *flag & 16 ) == 0 )
+        y = (FT_Pos)FT_GET_SHORT();
+
+      x     += y;
+      vec->x = x;
     }
 
     /* reading the Y coordinates */
 
+    vec       = gloader->current.outline.points;
+    vec_limit = vec + n_points;
+    flag      = (FT_Byte*)outline->tags;
+    x         = 0;
+
+    for ( ; vec < vec_limit; vec++, flag++ )
     {
-      FT_Vector*  vec   = gloader->current.outline.points;
-      FT_Vector*  limit = vec + n_points;
-      FT_Byte*    flag  = (FT_Byte*)outline->tags;
-      FT_Pos      x     = 0;
+      FT_Pos  y = 0;
 
 
-      for ( ; vec < limit; vec++, flag++ )
+      if ( *flag & 4 )
       {
-        FT_Pos  y = 0;
-
-
-        if ( *flag & 4 )
-        {
-          y = FT_GET_BYTE();
-          if ( ( *flag & 32 ) == 0 )
-            y = -y;
-        }
-        else if ( ( *flag & 32 ) == 0 )
-          y = FT_GET_SHORT();
-
-        x     += y;
-        vec->y = x;
+        y = (FT_Pos)FT_GET_BYTE();
+        if ( ( *flag & 32 ) == 0 )
+          y = -y;
       }
+      else if ( ( *flag & 32 ) == 0 )
+        y = (FT_Pos)FT_GET_SHORT();
+
+      x     += y;
+      vec->y = x;
     }
 
     /* clear the touch tags */