Commit 27695e5dbfc176a581afee6c96948ddc0a4941f7

Werner Lemberg 2000-11-23T08:21:13

* src/type1/t1load.c (parse_subrs, parse_charstrings): Use decrypt function from PSAux module. * src/type1/t1parse.c (T1_Done_Parse): Renamed to... (T1_Finalize_Parser): New function (to avoid name clash with a function in the PSAux module). (T1_Decrypt): Removed since it it duplicated in the PSAux module. (T1_Get_Private_Dict): Added `psaux' as new parameter; use decrypt function from PSAux module. * src/type1/t1parse.h: Adapted.

diff --git a/ChangeLog b/ChangeLog
index 7b8eadf..0ae7f05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2000-11-23  Werner Lemberg  <wl@gnu.org>
+
+	* src/type1/t1load.c (parse_subrs, parse_charstrings): Use decrypt
+	function from PSAux module.
+
+	* src/type1/t1parse.c (T1_Done_Parse): Renamed to...
+	(T1_Finalize_Parser): New function (to avoid name clash with a
+	function in the PSAux module).
+	(T1_Decrypt): Removed since it it duplicated in the PSAux module.
+	(T1_Get_Private_Dict): Added `psaux' as new parameter; use decrypt
+	function from PSAux module.
+
+	* src/type1/t1parse.h: Adapted.
+
 2000-11-22  Tom Kacvinsky  <tjk@ams.org>
 
 	* src/cff/t2objs.c (T2_Init_Face): For pure CFF fonts, set 
@@ -56,8 +70,10 @@
 	* builds/cygwin/freetype-config.in, builds/unix/freetype-config.in:
 	Move test down for empty --exec-prefix.
 	Fix --version.
+
 	* builds/cygwin/install.mk, builds/unix/install.mk: Use
 	$(INSTALL_SCRIPT) for installation of freetype-config.
+
 	* builds/cygwin/install.mk: Fix clean target names.
 
 2000-11-09  David Turner  <david@freetype.org>
diff --git a/src/cff/t2objs.c b/src/cff/t2objs.c
index e2958a5..c1d3f77 100644
--- a/src/cff/t2objs.c
+++ b/src/cff/t2objs.c
@@ -375,6 +375,7 @@
       {
         CFF_Font_Dict*  dict = &cff->top_font.font_dict;
 
+
         /* we need the `PSNames' module for pure-CFF and CEF formats */
         if ( !psnames )
         {
@@ -396,9 +397,9 @@
 
         /* set global bbox, as well as EM size */
         root->units_per_EM = 1000;
-        root->bbox      = dict->font_bbox;
-        root->ascender  = (FT_Short)root->bbox.yMax;
-        root->descender = (FT_Short)root->bbox.yMin;
+        root->bbox         = dict->font_bbox;
+        root->ascender     = (FT_Short)root->bbox.yMax;
+        root->descender    = (FT_Short)root->bbox.yMin;
 
         /* retrieve font family & style name */
         root->family_name = T2_Get_Name( &cff->name_index, face_index );
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 4c8e335..06381bc 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -1148,7 +1148,7 @@
       /*                                                         */
       if ( face->type1.private_dict.lenIV >= 0 )
       {
-        T1_Decrypt( base, size, 4330 );
+        psaux->t1_decrypt( base, size, 4330 );
         size -= face->type1.private_dict.lenIV;
         base += face->type1.private_dict.lenIV;
       }
@@ -1268,7 +1268,7 @@
 
         if ( face->type1.private_dict.lenIV >= 0 )
         {
-          T1_Decrypt( base, size, 4330 );
+          psaux->t1_decrypt( base, size, 4330 );
           size -= face->type1.private_dict.lenIV;
           base += face->type1.private_dict.lenIV;
         }
@@ -1567,7 +1567,7 @@
     T1_Release_Table( &loader->subrs );
 
     /* finalize parser */
-    T1_Done_Parser( parser );
+    T1_Finalize_Parser( parser );
   }
 
 
@@ -1599,7 +1599,7 @@
     if ( error )
       goto Exit;
 
-    error = T1_Get_Private_Dict( parser );
+    error = T1_Get_Private_Dict( parser, psaux );
     if ( error )
       goto Exit;
 
diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c
index 75edd6a..97a14ab 100644
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -236,7 +236,7 @@
 
 
   FT_LOCAL_DEF
-  void  T1_Done_Parser( T1_ParserRec*  parser )
+  void  T1_Finalize_Parser( T1_ParserRec*  parser )
   {
     FT_Memory   memory = parser->root.memory;
 
@@ -276,25 +276,8 @@
 
 
   FT_LOCAL_DEF
-  void  T1_Decrypt( FT_Byte*   buffer,
-                    FT_Int     length,
-                    FT_UShort  seed )
-  {
-    while ( length > 0 )
-    {
-      FT_Byte  plain;
-
-
-      plain     = ( *buffer ^ ( seed >> 8 ) );
-      seed      = ( *buffer + seed ) * 52845 + 22719;
-      *buffer++ = plain;
-      length--;
-    }
-  }
-
-
-  FT_LOCAL_DEF
-  FT_Error  T1_Get_Private_Dict( T1_ParserRec*  parser )
+  FT_Error  T1_Get_Private_Dict( T1_ParserRec*     parser,
+                                 PSAux_Interface*  psaux )
   {
     FT_Stream  stream = parser->stream;
     FT_Memory  memory = parser->root.memory;
@@ -473,7 +456,7 @@
     }
 
     /* we now decrypt the encoded binary private dictionary */
-    T1_Decrypt( parser->private_dict, parser->private_len, 55665 );
+    psaux->t1_decrypt( parser->private_dict, parser->private_len, 55665 );
     parser->root.base = parser->private_dict;
     parser->root.cursor = parser->private_dict;
     parser->root.limit  = parser->root.cursor + parser->private_len;
diff --git a/src/type1/t1parse.h b/src/type1/t1parse.h
index 5d53a9f..f114e77 100644
--- a/src/type1/t1parse.h
+++ b/src/type1/t1parse.h
@@ -118,15 +118,11 @@
                            PSAux_Interface*  psaux );
 
   FT_LOCAL
-  FT_Error  T1_Get_Private_Dict( T1_ParserRec*  parser );
+  FT_Error  T1_Get_Private_Dict( T1_ParserRec*     parser,
+                                 PSAux_Interface*  psaux );
 
   FT_LOCAL
-  void  T1_Decrypt( FT_Byte*   buffer,
-                    FT_Int     length,
-                    FT_UShort  seed );
-
-  FT_LOCAL
-  void  T1_Done_Parser( T1_ParserRec*  parser );
+  void  T1_Finalize_Parser( T1_ParserRec*  parser );
 
 
 #ifdef __cplusplus