shithub: freetype+ttf2subf

Download patch

ref: 88c0478dce25738b7ab266f91e1db52969c86461
parent: 75aae7db173c60bc2c75fe2f191806d53e10a78b
author: Werner Lemberg <[email protected]>
date: Thu Jun 12 09:14:15 EDT 2003

* include/freetype/internal/psaux.h (T1_FieldType): Add
T1_FIELD_TYPE_KEY.
(T1_FIELD_KEY): New macro.
* src/psaux/psobjs.c (ps_parser_load_field): Handle
T1_FIELD_TYPE_KEY.

* src/cid/cidtoken.h: Use T1_FIELD_KEY for /CIDFontName.


* src/cache/ftlru.c (FT_LruList_Remove_Selection): Decrease
number of nodes.
(FT_LruList_Lookup): Fix assertion for out-of-memory case.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2003-06-12  Werner Lemberg  <[email protected]>
+
+	* include/freetype/internal/psaux.h (T1_FieldType): Add
+	T1_FIELD_TYPE_KEY.
+	(T1_FIELD_KEY): New macro.
+	* src/psaux/psobjs.c (ps_parser_load_field): Handle
+	T1_FIELD_TYPE_KEY.
+
+	* src/cid/cidtoken.h: Use T1_FIELD_KEY for /CIDFontName.
+
+2003-06-11  Alexander Malmberg  <[email protected]>
+
+	* src/cache/ftlru.c (FT_LruList_Remove_Selection): Decrease
+	number of nodes.
+	(FT_LruList_Lookup): Fix assertion for out-of-memory case.
+
 2003-06-11  Werner Lemberg  <[email protected]>
 
 	* src/cid/cidload.c (cid_decrypt): Removed.
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -183,6 +183,7 @@
     T1_FIELD_TYPE_FIXED_1000,
     T1_FIELD_TYPE_FIXED_1000_P,
     T1_FIELD_TYPE_STRING,
+    T1_FIELD_TYPE_KEY,
     T1_FIELD_TYPE_BBOX,
     T1_FIELD_TYPE_INTEGER_ARRAY,
     T1_FIELD_TYPE_FIXED_ARRAY,
@@ -292,6 +293,9 @@
 
 #define T1_FIELD_STRING( _ident, _fname )                             \
           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname )
+
+#define T1_FIELD_KEY( _ident, _fname )                             \
+          T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname )
 
 #define T1_FIELD_BBOX( _ident, _fname )                             \
           T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname )
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -227,7 +227,7 @@
   
           if ( node == NULL )
           {
-            FT_ASSERT( list->nodes == 0 );
+            FT_ASSERT( list->num_nodes == 0 );
             error = FT_Err_Out_Of_Memory;
             goto Exit;
           }
@@ -245,7 +245,7 @@
            * a classic destroy/create cycle.
            */
           *pnode = NULL;
-          list->num_nodes -= 1;
+          list->num_nodes--;
   
           if ( clazz->node_flush )
           {
@@ -379,6 +379,7 @@
           clazz->node_done( node, list );
 
         FT_FREE( node );
+        list->num_nodes--;
       }
       else
         pnode = &(*pnode)->next;
--- a/src/cid/cidtoken.h
+++ b/src/cid/cidtoken.h
@@ -21,7 +21,7 @@
 #undef  T1CODE
 #define T1CODE        T1_FIELD_LOCATION_CID_INFO
 
-  T1_FIELD_STRING( "CIDFontName", cid_font_name )
+  T1_FIELD_KEY   ( "CIDFontName", cid_font_name )
   T1_FIELD_NUM   ( "CIDFontVersion", cid_version )
   T1_FIELD_NUM   ( "CIDFontType", cid_font_type )
   T1_FIELD_STRING( "Registry", registry )
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -956,7 +956,7 @@
         case 1:
           {
             FT_Memory  memory = parser->memory;
-            FT_Byte    *p;
+            FT_Byte*   p;
 
 
             /* with synthetic fonts, it's possible to find a field twice */
@@ -973,8 +973,8 @@
 
         case 2:
           {
-            FT_Memory  memory = parser->memory;
-            FT_UShort  *p;
+            FT_Memory   memory = parser->memory;
+            FT_UShort*  p;
 
 
             /* with synthetic fonts, it's possible to find a field twice */
@@ -991,8 +991,8 @@
 
         case 4:
           {
-            FT_Memory  memory = parser->memory;
-            FT_UInt32  *p;
+            FT_Memory   memory = parser->memory;
+            FT_UInt32*  p;
 
 
             /* with synthetic fonts, it's possible to find a field twice */
@@ -1010,7 +1010,7 @@
         default:
           {
             FT_Memory  memory = parser->memory;
-            FT_Long  *p;
+            FT_Long*   p;
 
 
             /* with synthetic fonts, it's possible to find a field twice */
@@ -1028,6 +1028,7 @@
         break;
 
       case T1_FIELD_TYPE_STRING:
+      case T1_FIELD_TYPE_KEY:
         {
           FT_Memory  memory = parser->memory;
           FT_UInt    len    = (FT_UInt)( limit - cur );
@@ -1036,6 +1037,12 @@
           /* with synthetic fonts, it's possible to find a field twice */
           if ( *(FT_String**)q )
             break;
+
+          if ( field->type == T1_FIELD_TYPE_KEY )
+          {
+            len--;
+            cur++;
+          }
 
           if ( FT_ALLOC( string, len + 1 ) )
             goto Exit;