Commit 2bf2b9cc21c3ef45f213ca588f563559926c63cd

David Turner 2002-03-20T09:44:20

* include/freetype/internal/ftobjs.h: changing the definition of FT_CMap_CharNextFunc slightly * src/cff/*.c: updating CFF type definitions.

diff --git a/ChangeLog b/ChangeLog
index 489c023..fec37e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-03-20  David Turner    <david@freetype.org>
+
+        * include/freetype/internal/ftobjs.h: changing the definition of
+        FT_CMap_CharNextFunc slightly
+
+        * src/cff/*.c: updating CFF type definitions.
+
 2002-03-14  David Turner    <david@freetype.org>
 
         * include/freetype/internal/autohint.h, src/autohint/ahmodule.c,
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 6459c6c..d269d1e 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -214,9 +214,8 @@ FT_BEGIN_HEADER
   typedef FT_UInt   (*FT_CMap_CharIndexFunc)( FT_CMap      cmap,
                                               FT_UInt32    char_code );
 
-  typedef FT_UInt32 (*FT_CMap_CharNextFunc)( FT_CMap     cmap,
-                                             FT_UInt32   char_code,
-                                             FT_UInt    *agindex );
+  typedef FT_UInt   (*FT_CMap_CharNextFunc)( FT_CMap     cmap,
+                                             FT_UInt32  *achar_code );
 
   typedef struct FT_CMap_ClassRec_
   {
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index c270ac0..9ee3e03 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1515,10 +1515,10 @@
 
   static FT_Error
   CFF_Load_Charset( CFF_Charset  charset,
-                    FT_UInt       num_glyphs,
-                    FT_Stream     stream,
-                    FT_ULong      base_offset,
-                    FT_ULong      offset )
+                    FT_UInt      num_glyphs,
+                    FT_Stream    stream,
+                    FT_ULong     base_offset,
+                    FT_ULong     offset )
   {
     FT_Memory  memory     = stream->memory;
     FT_Error   error      = 0;
@@ -1964,7 +1964,7 @@
                     FT_ULong      base_offset )
   {
     FT_Error        error;
-    CFF_Parser      parser;
+    CFF_ParserRec      parser;
     FT_Byte*        dict;
     FT_ULong        dict_len;
     CFF_FontRecDict  top  = &font->font_dict;
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 5061396..b3631ba 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -248,125 +248,6 @@
   }
 
 
-#if 0
-
-  /* this function is used to build a Unicode charmap from the glyph names */
-  /* in a file                                                             */
-  static FT_Error
-  CFF_Build_Unicode_Charmap( CFF_Face            face,
-                             FT_ULong            base_offset,
-                             PSNames_Service  psnames )
-  {
-    CFF_Font       font = (CFF_Font)face->extra.data;
-    FT_Memory       memory = FT_FACE_MEMORY(face);
-    FT_UInt         n, num_glyphs = face->root.num_glyphs;
-    const char**    glyph_names;
-    FT_Error        error;
-    CFF_FontRecDict  dict = &font->top_font.font_dict;
-    FT_ULong        charset_offset;
-    FT_Byte         format;
-    FT_Stream       stream = face->root.stream;
-
-
-    charset_offset = dict->charset_offset;
-    if ( !charset_offset )
-    {
-      FT_ERROR(( "CFF_Build_Unicode_Charmap: charset table is missing\n" ));
-      error = CFF_Err_Invalid_File_Format;
-      goto Exit;
-    }
-
-    /* allocate the charmap */
-    if ( ALLOC( face->charmap, ...
-
-    /* seek to charset table and allocate glyph names table */
-    if ( FILE_Seek( base_offset + charset_offset )           ||
-         ALLOC_ARRAY( glyph_names, num_glyphs, const char* ) )
-      goto Exit;
-
-    /* now, read each glyph name and store it in the glyph name table */
-    if ( READ_Byte( format ) )
-      goto Fail;
-
-    switch ( format )
-    {
-    case 0:  /* format 0 - one SID per glyph */
-      {
-        const char**  gname = glyph_names;
-        const char**  limit = gname + num_glyphs;
-
-
-        if ( ACCESS_Frame( num_glyphs * 2 ) )
-          goto Fail;
-
-        for ( ; gname < limit; gname++ )
-          gname[0] = CFF_Get_String( &font->string_index,
-                                     GET_UShort(),
-                                     psnames );
-        FORGET_Frame();
-        break;
-      }
-
-    case 1:  /* format 1 - sequential ranges                    */
-    case 2:  /* format 2 - sequential ranges with 16-bit counts */
-      {
-        const char**  gname = glyph_names;
-        const char**  limit = gname + num_glyphs;
-        FT_UInt       len = 3;
-
-
-        if ( format == 2 )
-          len++;
-
-        while ( gname < limit )
-        {
-          FT_UInt  first;
-          FT_UInt  count;
-
-
-          if ( ACCESS_Frame( len ) )
-            goto Fail;
-
-          first = GET_UShort();
-          if ( format == 3 )
-            count = GET_UShort();
-          else
-            count = GET_Byte();
-
-          FORGET_Frame();
-
-          for ( ; count > 0; count-- )
-          {
-            gname[0] = CFF_Get_String( &font->string_index,
-                                       first,
-                                       psnames );
-            gname++;
-            first++;
-          }
-        }
-        break;
-      }
-
-    default:   /* unknown charset format! */
-      FT_ERROR(( "CFF_Build_Unicode_Charmap: unknown charset format!\n" ));
-      error = CFF_Err_Invalid_File_Format;
-      goto Fail;
-    }
-
-    /* all right, the glyph names were loaded; we now need to create */
-    /* the corresponding unicode charmap                             */
-
-  Fail:
-    for ( n = 0; n < num_glyphs; n++ )
-      FREE( glyph_names[n] );
-
-    FREE( glyph_names );
-
-  Exit:
-    return error;
-  }
-
-#endif /* 0 */
 
 
   static FT_Encoding
@@ -418,29 +299,6 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    CFF_Face_Init                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Initializes a given OpenType face object.                          */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    stream     :: The source font stream.                              */
-  /*                                                                       */
-  /*    face_index :: The index of the font face in the resource.          */
-  /*                                                                       */
-  /*    num_params :: Number of additional generic parameters.  Ignored.   */
-  /*                                                                       */
-  /*    params     :: Additional generic parameters.  Ignored.             */
-  /*                                                                       */
-  /* <InOut>                                                               */
-  /*    face       :: The newly built face object.                         */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
   CFF_Face_Init( FT_Stream      stream,
                  CFF_Face       face,
@@ -694,17 +552,6 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    CFF_Face_Done                                                      */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Finalizes a given face object.                                     */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    face :: A pointer to the face object to destroy.                   */
-  /*                                                                       */
   FT_LOCAL_DEF( void )
   CFF_Face_Done( CFF_Face  face )
   {
@@ -728,20 +575,6 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    CFF_Driver_Init                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Initializes a given OpenType driver object.                        */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    driver :: A handle to the target driver object.                    */
-  /*                                                                       */
-  /* <Return>                                                              */
-  /*    FreeType error code.  0 means success.                             */
-  /*                                                                       */
   FT_LOCAL_DEF( FT_Error )
   CFF_Driver_Init( CFF_Driver  driver )
   {
@@ -761,17 +594,6 @@
   }
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* <Function>                                                            */
-  /*    CFF_Driver_Done                                                    */
-  /*                                                                       */
-  /* <Description>                                                         */
-  /*    Finalizes a given OpenType driver.                                 */
-  /*                                                                       */
-  /* <Input>                                                               */
-  /*    driver :: A handle to the target OpenType driver.                  */
-  /*                                                                       */
   FT_LOCAL_DEF( void )
   CFF_Driver_Done( CFF_Driver  driver )
   {
diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
index 515c396..65a49c8 100644
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -48,7 +48,7 @@
 
 
   /* now generate handlers for the most simple fields */
-  typedef FT_Error  (*CFF_Field_Reader)( CFF_Parser*  parser );
+  typedef FT_Error  (*CFF_Field_Reader)( CFF_Parser   parser );
 
   typedef struct  CFF_Field_Handler_
   {
@@ -64,7 +64,7 @@
 
 
   FT_LOCAL_DEF( void )
-  CFF_Parser_Init( CFF_Parser*  parser,
+  CFF_Parser_Init( CFF_Parser   parser,
                    FT_UInt      code,
                    void*        object )
   {
@@ -311,7 +311,7 @@
   }
 
   static FT_Error
-  cff_parse_font_matrix( CFF_Parser*  parser )
+  cff_parse_font_matrix( CFF_Parser   parser )
   {
     CFF_FontRecDict  dict   = (CFF_FontRecDict)parser->object;
     FT_Matrix*      matrix = &dict->font_matrix;
@@ -359,7 +359,7 @@
 
 
   static FT_Error
-  cff_parse_font_bbox( CFF_Parser*  parser )
+  cff_parse_font_bbox( CFF_Parser   parser )
   {
     CFF_FontRecDict  dict = (CFF_FontRecDict)parser->object;
     FT_BBox*        bbox = &dict->font_bbox;
@@ -383,7 +383,7 @@
 
 
   static FT_Error
-  cff_parse_private_dict( CFF_Parser*  parser )
+  cff_parse_private_dict( CFF_Parser   parser )
   {
     CFF_FontRecDict  dict = (CFF_FontRecDict)parser->object;
     FT_Byte**       data = parser->stack;
@@ -404,7 +404,7 @@
 
 
   static FT_Error
-  cff_parse_cid_ros( CFF_Parser*  parser )
+  cff_parse_cid_ros( CFF_Parser   parser )
   {
     CFF_FontRecDict  dict = (CFF_FontRecDict)parser->object;
     FT_Byte**       data = parser->stack;
@@ -480,7 +480,7 @@
 
 
   FT_LOCAL_DEF( FT_Error )
-  CFF_Parser_Run( CFF_Parser*  parser,
+  CFF_Parser_Run( CFF_Parser   parser,
                   FT_Byte*     start,
                   FT_Byte*     limit )
   {
diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h
index 39e45b1..045fa25 100644
--- a/src/cff/cffparse.h
+++ b/src/cff/cffparse.h
@@ -34,7 +34,7 @@ FT_BEGIN_HEADER
 #define CFF_CODE_PRIVATE  0x2000
 
 
-  typedef struct  CFF_Parser_
+  typedef struct  CFF_ParserRec_
   {
     FT_Byte*   start;
     FT_Byte*   limit;
@@ -46,16 +46,16 @@ FT_BEGIN_HEADER
     FT_UInt    object_code;
     void*      object;
 
-  } CFF_Parser;
+  } CFF_ParserRec, *CFF_Parser;
 
 
   FT_LOCAL( void )
-  CFF_Parser_Init( CFF_Parser*  parser,
+  CFF_Parser_Init( CFF_Parser   parser,
                    FT_UInt      code,
                    void*        object );
 
   FT_LOCAL( FT_Error )
-  CFF_Parser_Run( CFF_Parser*  parser,
+  CFF_Parser_Run( CFF_Parser   parser,
                   FT_Byte*     start,
                   FT_Byte*     limit );