Commit f25ce9d0b37138df6ca1329cc09a3b4074b0cfe7

Werner Lemberg 2002-08-15T23:07:18

* src/cff/cffgload.c (cff_free_glyph_data), src/cff/cffload.c (cff_font_load): Use FT_UNUSED. * src/base/ftglyph.c (FT_Glyph_To_Bitmap): Initialize `error'. * src/sfnt/sfobjs.c (SFNT_Load_Face): Fix compiler warning.

diff --git a/ChangeLog b/ChangeLog
index a3dc7e9..410c195 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,32 @@
+2002-08-16  Werner Lemberg  <wl@gnu.org>
+
+	* src/cff/cffgload.c (cff_free_glyph_data),
+	src/cff/cffload.c (cff_font_load): Use FT_UNUSED.
+
+2002-08-15  Werner Lemberg  <wl@gnu.org>
+
+	* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Initialize `error'.
+	* src/sfnt/sfobjs.c (SFNT_Load_Face): Fix compiler warning.
+
 2002-08-15  Graham Asher  <graham.asher@btinternet.com>
 
-    * src/cff/cffgload.c, src/cff/cffload.c, src/cff/cffload.h,
-    src/cff/cffobjs.c [FT_CONFIG_OPTION_INCREMENTAL]:
-    implemented the incremental font loading system for
-    the CFF driver.  Tested using the GhostScript-to-FreeType
-    bridge (under development).
+	Implemented the incremental font loading system for the CFF driver. 
+	Tested using the GhostScript-to-FreeType bridge (under development).
 
-    * src/cid/cidgload.c [FT_CONFIG_OPTION_INCREMENTAL]:
-	corrected the incremental font loading implementation to
-	use the new system introduced on 2002-08-01.
+	* src/cff/cffgload.c (cff_get_glyph_data, cff_free_glyph_data): New
+	functions.
+	(cff_operator_seac, cff_compute_max_advance, cff_slot_load): Use
+	them.
+	* src/cff/cffload.c (cff_font_load): Add `face' parameter.
+	Load charset and encoding only if there are glyphs.
+	[FT_CONFIG_OPTION_INCREMENTAL]: Incremental fonts don't need
+	character recipes.
+	* src/cff/cffload.h, src/cff/cffobjs.c: Updated.
+
+	* src/cid/cidgload.c (cid_load_glyph)
+	[FT_CONFIG_OPTION_INCREMENTAL]: Corrected the incremental font
+	loading implementation to use the new system introduced on
+	2002-08-01.
 
 2002-08-06  Werner Lemberg  <wl@gnu.org>
 
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index cb1c8ea..f7c7068 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -572,7 +572,7 @@
                       FT_Bool     destroy )
   {
     FT_GlyphSlotRec  dummy;
-    FT_Error         error;
+    FT_Error         error = FT_Err_Ok;
     FT_Glyph         glyph;
     FT_BitmapGlyph   bitmap = NULL;
 
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 5ba5b80..753cf97 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -570,20 +570,25 @@
     /* For incremental fonts get the character data using the */
     /* callback function.                                     */
     if ( face->root.internal->incremental_interface )
-	{
-	  FT_Data data;
-      FT_Error error = face->root.internal->incremental_interface->funcs->get_glyph_data(
-               face->root.internal->incremental_interface->object,
-               glyph_index, &data );
+    {
+      FT_Data   data;
+      FT_Error  error = face->root.internal->incremental_interface->funcs->get_glyph_data(
+                          face->root.internal->incremental_interface->object,
+                          glyph_index, &data );
+
+
       *pointer = (FT_Byte*)data.pointer;
-      *length = data.length;
+      *length  = data.length;
+
       return error;
     }
     else
-#endif
+#endif /* FT_CONFIG_OPTION_INCREMENTAL */
 
     {
-      CFF_Font  cff  = (CFF_Font)(face->extra.data);
+      CFF_Font  cff = (CFF_Font)(face->extra.data);
+
+
       return cff_index_access_element( &cff->charstrings_index, glyph_index,
                                        pointer, length );
     }
@@ -596,25 +601,29 @@
                        FT_ULong   length )
   {
 #ifndef FT_CONFIG_OPTION_INCREMENTAL
-    length; /* Prevent compiler warning about unreferenced parameter. */
+    FT_UNUSED( length );
 #endif
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
     /* For incremental fonts get the character data using the */
     /* callback function.                                     */
     if ( face->root.internal->incremental_interface )
-	{
-      FT_Data data;
-	  data.pointer = *pointer;
-	  data.length = length;
+    {
+      FT_Data  data;
+
+
+      data.pointer = *pointer;
+      data.length  = length;
       face->root.internal->incremental_interface->funcs->free_glyph_data(
         face->root.internal->incremental_interface->object,&data );
     }
     else
-#endif
+#endif /* FT_CONFIG_OPTION_INCREMENTAL */
 
     {
-      CFF_Font  cff  = (CFF_Font)(face->extra.data);
+      CFF_Font  cff = (CFF_Font)(face->extra.data);
+
+
       cff_index_forget_element( &cff->charstrings_index, pointer );
     }
   }
@@ -714,7 +723,8 @@
                                 &charstring, &charstring_len );
     if ( !error )
     {
-      error = cff_decoder_parse_charstrings( decoder, charstring, charstring_len );
+      error = cff_decoder_parse_charstrings( decoder, charstring,
+                                             charstring_len );
 
       if ( error )
         goto Exit;
@@ -2302,7 +2312,7 @@
 
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
-     	/* Control data and length may not be available for incremental   */
+        /* Control data and length may not be available for incremental   */
         /* fonts.                                                         */
         if ( face->root.internal->incremental_interface )
         {
@@ -2310,16 +2320,19 @@
           glyph->root.control_len = 0;
         }
         else
-#endif
+#endif /* FT_CONFIG_OPTION_INCREMENTAL */
+
         /* We set control_data and control_len if charstrings is loaded.  */
         /* See how charstring loads at cff_index_access_element() in      */
         /* cffload.c.                                                     */
         {
-        CFF_IndexRec csindex = cff->charstrings_index;
-        glyph->root.control_data =
-          csindex.bytes + csindex.offsets[glyph_index] - 1;
-        glyph->root.control_len =
-          charstring_len;
+          CFF_IndexRec  csindex = cff->charstrings_index;
+
+
+          glyph->root.control_data =
+            csindex.bytes + csindex.offsets[glyph_index] - 1;
+          glyph->root.control_len =
+            charstring_len;
         }
       }
 
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 4e5da87..be40d0e 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -2048,11 +2048,11 @@
     FT_ULong         base_offset;
     CFF_FontRecDict  dict;
 
-
 #ifndef FT_CONFIG_OPTION_INCREMENTAL
-    face; /* Prevent compiler warning about unreferenced parameter. */
+    FT_UNUSED( face );
 #endif
 
+
     FT_ZERO( font );
 
     font->stream = stream;
@@ -2165,11 +2165,10 @@
       font->num_subfonts = 0;
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
-	/* Incremental fonts don't need character recipes. */
-    if (!face->root.internal->incremental_interface)
+    /* Incremental fonts don't need character recipes. */
+    if ( !face->root.internal->incremental_interface )
 #endif
-      {
-
+    {
       /* read the charstrings index now */
       if ( dict->charstrings_offset == 0 )
       {
@@ -2184,7 +2183,7 @@
       error = cff_new_index( &font->charstrings_index, stream, 0 );
       if ( error )
         goto Exit;
-	  }
+    }
 
     /* explicit the global subrs */
     font->num_global_subrs = font->global_subrs_index.count;
@@ -2200,7 +2199,7 @@
     if ( font->num_glyphs > 0 )
     {
       error = cff_charset_load( &font->charset, font->num_glyphs, stream,
-                              base_offset, dict->charset_offset );
+                                base_offset, dict->charset_offset );
       if ( error )
         goto Exit;
 
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index 95f3e5d..04a66c2 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -71,14 +71,15 @@
       fd_select = (FT_UInt)cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
 
       if ( glyph_data.length != 0 )
-	  {
+      {
         glyph_length = glyph_data.length - cid->fd_bytes;
         FT_ALLOC( charstring, glyph_length );
-	    if ( !error )
-          ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes, glyph_length );
-	  }
+        if ( !error )
+          ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes,
+                     glyph_length );
+      }
 
-	  face->root.internal->incremental_interface->funcs->free_glyph_data(
+      face->root.internal->incremental_interface->funcs->free_glyph_data(
                 face->root.internal->incremental_interface->object,
                 &glyph_data );
 
@@ -163,6 +164,7 @@
       FT_Bool                    found = FALSE;
       FT_Incremental_MetricsRec  metrics;
 
+
       error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
                 face->root.internal->incremental_interface->object,
                 glyph_index, FALSE, &metrics, &found );
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index a6c731f..ff7a5d8 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -516,7 +516,6 @@
     {
       FT_Face    root = &face->root;
       FT_Int     flags = 0;
-      FT_Int     n;
       FT_Memory  memory;
 
 
@@ -614,11 +613,13 @@
       }
 
 
-
 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
 
       if ( face->num_sbit_strikes )
       {
+        FT_Int  n;
+
+
         root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
 
 #if 0