Commit b1859049e2d7631c48dd738d5e10b92777a61d6c

Werner Lemberg 2002-05-22T04:53:25

* src/psaux/psobjs.c (T1Radix): New function. (t1_toint): Use it to handle numbers in radix format. * src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Add dummy for undocumented, obsolete opcode 15.

diff --git a/ChangeLog b/ChangeLog
index d17c79e..5558a7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,18 +1,25 @@
+2002-05-21  Martin Muskens  <mmuskens@aurelon.com>
+
+	* src/psaux/psobjs.c (T1Radix): New function.
+	(t1_toint): Use it to handle numbers in radix format.
+
+	* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Add dummy
+	for undocumented, obsolete opcode 15.
+
 2002-05-21  David Turner  <david@freetype.org>
 
-        * src/bdf/bdflic.c: removed compiler warning, and changed all tables
-          to the "static const" storage specifier (instead of simply 'static')
+	* src/bdf/bdflic.c: Removed compiler warning, and changed all tables
+	to the "static const" storage specifier (instead of simply
+	`static').
 
-        * src/type42/t32drivr.c, src/bdf/bdfdrivr.c:
-          removing compiler warnings
+	* src/type42/t32drivr.c, src/bdf/bdfdrivr.c: Removing compiler
+	warnings.
 
-        * include/freetype/internal/ftbdf.h, src/base/ftbdf.c,
-          src/base/descrip.mms, src/base/Jamfile, src/base/rules.mk:
-          
-          Adding a new API called "FT_Get_BDF_Charset_ID" to retrieve
-          BDF-specific strings from a face. This is much cleaner
-          than accessing the internal types "BDF_Public_Face" defined in
-          FT_INTERNAL_BDF_TYPES_H
+	* include/freetype/internal/ftbdf.h, src/base/ftbdf.c,
+	src/base/descrip.mms, src/base/Jamfile, src/base/rules.mk
+	(FT_Get_BDF_Charset_ID): New API to retrieve BDF-specific strings
+	from a face.  This is much cleaner than accessing the internal types
+	"BDF_Public_Face" defined in FT_INTERNAL_BDF_TYPES_H.
 
 2002-05-21  Werner Lemberg  <wl@gnu.org>
 
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index 891edb0..c24a0c7 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -435,12 +435,49 @@
 
 
   static FT_Long
+  T1Radix( FT_Long    radixBase,
+           FT_Byte**  cur,
+           FT_Byte*   limit )
+  {
+    FT_Long  result = 0;
+    FT_Byte  radixEndChar0 =
+               (FT_Byte)( radixBase > 10 ? '9' + 1 : '0' + radixBase );
+    FT_Byte  radixEndChar1 =
+               (FT_Byte)( 'A' + radixBase - 10 );
+    FT_Byte  radixEndChar2 =
+               (FT_Byte)( 'a' + radixBase - 10 );
+
+
+    while( *cur < limit )
+    {
+      if ( (*cur)[0] >= '0' && (*cur)[0] < radixEndChar0 )
+        result = result * radixBase + (*cur)[0] - '0';
+
+      else if ( radixBase > 10 &&
+                (*cur)[0] >= 'A' && (*cur)[0] < radixEndChar1 )
+        result = result * radixBase + ( (*cur)[0] - 'A' + 10 );
+
+      else if ( radixBase > 10 &&
+                (*cur)[0] >= 'a' && (*cur)[0] < radixEndChar2 )
+        result = result * radixBase + ( (*cur)[0] - 'a' + 10 );
+
+      else
+        return result;
+
+      (*cur)++;
+    }
+
+    return result;
+  }
+
+
+  static FT_Long
   t1_toint( FT_Byte**  cursor,
             FT_Byte*   limit )
   {
     FT_Long   result = 0;
     FT_Byte*  cur    = *cursor;
-    FT_Byte   c = '\0', d;
+    FT_Byte   c      = '\0', d;
 
 
     for ( ; cur < limit; cur++ )
@@ -463,7 +500,14 @@
       {
         d = (FT_Byte)( cur[0] - '0' );
         if ( d >= 10 )
+        {
+          if ( cur[0] == '#' )
+          {
+            cur++;
+            result = T1Radix( result, &cur, limit );
+          }
           break;
+        }
 
         result = result * 10 + d;
         cur++;
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index b183fcb..4544ad1 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -432,6 +432,10 @@
         op = op_endchar;
         break;
 
+      case 15:          /* undocumented, obsolete operator */
+        op = op_none;
+        break;
+
       case 21:
         op = op_rmoveto;
         break;