shithub: freetype+ttf2subf

Download patch

ref: 75aae7db173c60bc2c75fe2f191806d53e10a78b
parent: fdc042b8a94e591d2d4405123cb6d9f9c6c990d8
author: Werner Lemberg <[email protected]>
date: Thu Jun 12 03:11:05 EDT 2003

* 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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2003-06-11  Werner Lemberg  <[email protected]>
 
+	* 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  <[email protected]>
+
 	* src/cid/cidobjs.c: Apply change 2003-05-31 from <[email protected]>.
 	Compute style flags.
 	Fix computation of root->height.
--- 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,
--- 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 );
         }
       }
 
--- 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,       */
@@ -39,11 +39,6 @@
   FT_LOCAL( FT_Long )
   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 );