Commit 75aae7db173c60bc2c75fe2f191806d53e10a78b

Werner Lemberg 2003-06-12T07:11:05

* src/cid/cidload.c (cid_decrypt): Removed. (cid_read_subrs): Use t1_decrypt from psaux module. * src/cid/cidload.h: Updated. * src/cid/cidgload.c (cid_load_glyph): Use t1_decrypt from psaux module.

diff --git a/ChangeLog b/ChangeLog
index 5554089..cbab9d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2003-06-11  Werner Lemberg  <wl@gnu.org>
 
+	* src/cid/cidload.c (cid_decrypt): Removed.
+	(cid_read_subrs): Use t1_decrypt from psaux module.
+	* src/cid/cidload.h: Updated.
+	* src/cid/cidgload.c (cid_load_glyph): Use t1_decrypt from psaux
+	module.
+
+2003-06-10  Werner Lemberg  <wl@gnu.org>
+
 	* src/cid/cidobjs.c: Apply change 2003-05-31 from <Ron.Dev@gmx.de>.
 	Compute style flags.
 	Fix computation of root->height.
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index 59c2276..9d18810 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -40,15 +40,16 @@
   cid_load_glyph( T1_Decoder  decoder,
                   FT_UInt     glyph_index )
   {
-    CID_Face      face = (CID_Face)decoder->builder.face;
-    CID_FaceInfo  cid  = &face->cid;
-    FT_Byte*      p;
-    FT_UInt       fd_select;
-    FT_Stream     stream = face->root.stream;
-    FT_Error      error  = 0;
-    FT_Byte*      charstring = 0;
-    FT_Memory     memory = face->root.memory;
-    FT_ULong      glyph_length = 0;
+    CID_Face       face = (CID_Face)decoder->builder.face;
+    CID_FaceInfo   cid  = &face->cid;
+    FT_Byte*       p;
+    FT_UInt        fd_select;
+    FT_Stream      stream = face->root.stream;
+    FT_Error       error  = 0;
+    FT_Byte*       charstring = 0;
+    FT_Memory      memory = face->root.memory;
+    FT_ULong       glyph_length = 0;
+    PSAux_Service  psaux = (PSAux_Service)face->psaux;
 
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
@@ -145,7 +146,7 @@
 
       /* Decrypt only if lenIV >= 0. */
       if ( decoder->lenIV >= 0 )
-        cid_decrypt( charstring, glyph_length, 4330 );
+        psaux->t1_decrypt( charstring, glyph_length, 4330 );
 
       error = decoder->funcs.parse_charstrings(
                 decoder, charstring + cs_offset,
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index 77d76a8..1458025 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -57,24 +57,6 @@
   }
 
 
-  FT_LOCAL_DEF( void )
-  cid_decrypt( FT_Byte*   buffer,
-               FT_Offset  length,
-               FT_UShort  seed )
-  {
-    while ( length > 0 )
-    {
-      FT_Byte  plain;
-
-
-      plain     = (FT_Byte)( *buffer ^ ( seed >> 8 ) );
-      seed      = (FT_UShort)( ( *buffer + seed ) * 52845U + 22719 );
-      *buffer++ = plain;
-      length--;
-    }
-  }
-
-
   /*************************************************************************/
   /*************************************************************************/
   /*****                                                               *****/
@@ -385,14 +367,15 @@
   static FT_Error
   cid_read_subrs( CID_Face  face )
   {
-    CID_FaceInfo  cid    = &face->cid;
-    FT_Memory     memory = face->root.memory;
-    FT_Stream     stream = face->root.stream;
-    FT_Error      error;
-    FT_Int        n;
-    CID_Subrs     subr;
-    FT_UInt       max_offsets = 0;
-    FT_ULong*     offsets = 0;
+    CID_FaceInfo   cid    = &face->cid;
+    FT_Memory      memory = face->root.memory;
+    FT_Stream      stream = face->root.stream;
+    FT_Error       error;
+    FT_Int         n;
+    CID_Subrs      subr;
+    FT_UInt        max_offsets = 0;
+    FT_ULong*      offsets = 0;
+    PSAux_Service  psaux = (PSAux_Service)face->psaux;
 
 
     if ( FT_NEW_ARRAY( face->subrs, cid->num_dicts ) )
@@ -462,7 +445,7 @@
 
 
           len = offsets[count + 1] - offsets[count];
-          cid_decrypt( subr->code[count], len, 4330 );
+          psaux->t1_decrypt( subr->code[count], len, 4330 );
         }
       }
 
diff --git a/src/cid/cidload.h b/src/cid/cidload.h
index 8fc577d..a7f4bce 100644
--- a/src/cid/cidload.h
+++ b/src/cid/cidload.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    CID-keyed Type1 font loader (specification).                         */
 /*                                                                         */
-/*  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,       */
@@ -40,11 +40,6 @@ FT_BEGIN_HEADER
   cid_get_offset( FT_Byte**  start,
                   FT_Byte    offsize );
 
-  FT_LOCAL( void )
-  cid_decrypt( FT_Byte*   buffer,
-               FT_Offset  length,
-               FT_UShort  seed );
-
   FT_LOCAL( FT_Error )
   cid_face_open( CID_Face  face );