shithub: freetype+ttf2subf

Download patch

ref: 10bf05a31d63c6674fd057514d1066d1f081f4aa
parent: c78df1ef6ead341ee753f1d3239f71f101292cff
author: David Turner <[email protected]>
date: Wed Apr 21 10:30:37 EDT 2004

* src/cff/cffobjs.c (cff_face_init): fixed a small memory leak

        * src/autofit/afloader.c, src/autofit/afmodule.c, src/base/ftdebug.c:
        removed compiler warnings

        * src/autofit/aftypes.h, src/lzw/zopen.c, src/pcf/pcfdrivr.c,
        src/pcf/pcfread.c, src/psaux/psobjs.c, src/type42/t42drivr.c:
        changed data arrays to "const" to avoid populating the ".data"
        segment

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2004-04-21  David Turner    <[email protected]>
+
+        * src/cff/cffobjs.c (cff_face_init): fixed a small memory leak
+
+        * src/autofit/afloader.c, src/autofit/afmodule.c, src/base/ftdebug.c:
+        removed compiler warnings
+
+        * src/autofit/aftypes.h, src/lzw/zopen.c, src/pcf/pcfdrivr.c,
+        src/pcf/pcfread.c, src/psaux/psobjs.c, src/type42/t42drivr.c:
+        changed data arrays to "const" to avoid populating the ".data"
+        segment
+
 2004-04-20  Werner Lemberg  <[email protected]>
 
 	* src/psaux/psobjs.c (T1Radix): Renamed to...
@@ -262,7 +274,7 @@
 	(psh_blues_snap_stem): Don't use blue_shift but blue_threshold.
 
 	* src/pshinter/pshalgo.c (PSH_STRONG_THRESHOLD_MAXIMUM): New macro.
-	(psh_glyph_find_string_points): Use PSH_STRONG_THRESHOLD_MAXIMUM. 
+	(psh_glyph_find_string_points): Use PSH_STRONG_THRESHOLD_MAXIMUM.
 	(psh_glyph_find_blue_points): New function.  Needed for fonts like
 	p052003l.pfb (URW Palladio L Roman) which have flex curves at the
 	base line within blue zones, but the flex curves aren't covered by
@@ -362,7 +374,7 @@
 	accordingly.  These values are calculated outside of the function
 	now.
 	Add new argument `offsets'.
-	(IsMacResource): Use `FT_Raccess_Get_HeaderInfo' and 
+	(IsMacResource): Use `FT_Raccess_Get_HeaderInfo' and
 	`FT_Raccess_Get_DataOffsets'.
 	(load_face_in_embedded_rfork): New function.
 	(load_mac_face): Use load_face_in_embedded_rfork.
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -71,7 +71,6 @@
   {
     FT_Error          error    = 0;
     FT_Face           face     = loader->face;
-    AF_FaceGlobals    globals  = loader->globals;
     FT_GlyphLoader    gloader  = loader->gloader;
     AF_ScriptMetrics  metrics  = loader->metrics;
     AF_GlyphHints     hints    = &loader->hints;
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -31,6 +31,8 @@
                             FT_UInt        glyph_index,
                             FT_Int32       load_flags )
   {
+    FT_UNUSED(size);
+
     return af_loader_load_glyph( module->loader, slot->face,
                                  glyph_index, load_flags );
   }
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -17,7 +17,7 @@
  /**************************************************************************/
  /**************************************************************************/
 
-#define AF_DEBUG
+#define xxAF_DEBUG
 
 #ifdef AF_DEBUG
 
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -159,7 +159,7 @@
         q = p;
         while ( *p && *p != ':' )
           p++;
-          
+
         if ( *p == ':' && p > q )
         {
           FT_Int  n, i, len = (FT_Int)( p - q );
@@ -221,16 +221,18 @@
 
 
   FT_EXPORT_DEF( FT_Int )
-  FT_Trace_Get_Count( void ) 
+  FT_Trace_Get_Count( void )
   {
-    return 0; 
+    return 0;
   }
 
 
   FT_EXPORT_DEF( const char * )
-  FT_Trace_Get_Name( FT_Int  idx ) 
-  { 
-    return NULL; 
+  FT_Trace_Get_Name( FT_Int  idx )
+  {
+    FT_UNUSED( idx );
+
+    return NULL;
   }
 
 
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -73,7 +73,7 @@
 
     sbit_metrics = &size->strike_metrics;
 
-    error = sfnt->set_sbit_strike( face, 
+    error = sfnt->set_sbit_strike( face,
                                    metrics->x_ppem, metrics->y_ppem,
                                    &strike_index );
 
@@ -100,7 +100,7 @@
       size->strike_index = (FT_UInt)strike_index;
     }
     else
-    {   
+    {
       size->strike_index = 0xFFFFU;
 
       sbit_metrics->x_ppem      = 0;
@@ -113,7 +113,7 @@
 
     return error;
   }
-   
+
 #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
 
 
@@ -503,33 +503,50 @@
           char*  fullp  = full;
           char*  family = root->family_name;
 
-
+         /* we're going to try to extract the style name from the
+          * full name. We need to ignore spaces and dashes during
+          * the search.
+          */
           if ( full )
           {
             while ( *fullp )
             {
+             /* skip common characters at the start of both strings
+              */
               if ( *fullp == *family )
               {
                 family++;
                 fullp++;
+                continue;
               }
-              else
+
+             /* ignore spaces or dashes in full name during comparison
+              */
+              if ( *fullp == ' ' || *fullp == '-' )
               {
-                if ( *fullp == ' ' || *fullp == '-' )
-                  fullp++;
-                else if ( *family == ' ' || *family == '-' )
-                  family++;
-                else
-                {
-                  if ( !*family )
-                  {
-                    style_name = cff_strcpy( memory, fullp );
-                    FT_FREE( full );
-                  }
-                  break;
-                }
+                fullp++;
+                continue;
               }
+             /* ignore spaces and dashes in family name during comparison
+              */
+              if ( *family == ' ' || *family == '-' )
+              {
+                family++;
+                continue;
+              }
+
+              if ( !*family && *fullp )
+              {
+               /* the full name begins with the same characters than the
+                * family name, with spaces and dashes removed. In this
+                * case, the remaining string in "fullp" will be used
+                * as the style name
+                */
+                style_name = cff_strcpy( memory, fullp );
+              }
+              break;
             }
+            FT_FREE( full );
           }
         }
         else
--- a/src/lzw/zopen.c
+++ b/src/lzw/zopen.c
@@ -173,7 +173,7 @@
  * code in turn.  When the buffer fills up empty it and start over.
  */
 
-static char_type rmask[9] =
+static const char_type rmask[9] =
 	{0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
 
 /*
@@ -258,7 +258,7 @@
 		*stackp++ = finchar = tab_suffixof(code);
 
 		/* And put them out in forward order.  */
-middle:		
+middle:
 		if (stackp == de_stack)
 			continue;
 
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -501,7 +501,7 @@
   *  BDF SERVICE
   *
   */
-  
+
   static FT_Error
   pcf_get_bdf_property( PCF_Face          face,
                         const char*       prop_name,
@@ -546,7 +546,7 @@
   }
 
 
-  static FT_Service_BDFRec  pcf_service_bdf =
+  static const FT_Service_BDFRec  pcf_service_bdf =
   {
     (FT_BDF_GetCharsetIdFunc)pcf_get_charset_id,
     (FT_BDF_GetPropertyFunc) pcf_get_bdf_property
@@ -559,14 +559,14 @@
   *
   */
 
-  static FT_ServiceDescRec  pcf_services[] =
+  static const FT_ServiceDescRec  pcf_services[] =
   {
     { FT_SERVICE_ID_BDF,       &pcf_service_bdf },
     { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_PCF },
     { NULL, NULL }
   };
-  
-  
+
+
   static FT_Module_Interface
   pcf_driver_requester( FT_Module    module,
                         const char*  name )
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -49,7 +49,7 @@
 
 
 #if defined( FT_DEBUG_LEVEL_TRACE )
-  static const char*  tableNames[] =
+  static const char* const  tableNames[] =
   {
     "prop", "accl", "mtrcs", "bmps", "imtrcs",
     "enc", "swidth", "names", "accel"
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -285,7 +285,7 @@
 #if 'A' == 65
   /* ASCII */
 
-  char ft_char_table[128] =
+  static const char ft_char_table[128] =
   {
     /* 0x00 */
     -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -306,7 +306,7 @@
 #if 'A' == 193
   /* EBCDIC */
 
-  char ft_char_table[128] =
+  static const char ft_char_table[128] =
   {
     /* 0x80 */
     -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, -1, -1, -1, -1, -1, -1,
--- a/src/type42/t42drivr.c
+++ b/src/type42/t42drivr.c
@@ -102,7 +102,7 @@
   }
 
 
-  static FT_Service_GlyphDictRec  t42_service_glyph_dict =
+  static const FT_Service_GlyphDictRec  t42_service_glyph_dict =
   {
     (FT_GlyphDict_GetNameFunc)  t42_get_glyph_name,
     (FT_GlyphDict_NameIndexFunc)t42_get_name_index
@@ -122,7 +122,7 @@
   }
 
 
-  static FT_Service_PsFontNameRec  t42_service_ps_font_name =
+  static const FT_Service_PsFontNameRec  t42_service_ps_font_name =
   {
     (FT_PsName_GetFunc)t42_get_ps_font_name
   };