shithub: freetype+ttf2subf

Download patch

ref: 0bb4a0f93a8a241a3e499f62292b730fb340c339
parent: 3afd706dc639a086d14301be1e61c98a68de2c19
author: Werner Lemberg <[email protected]>
date: Wed Jun 19 11:57:55 EDT 2002

* src/psaux/t1cmap.c (t1_cmap_custom_char_index,
t1_cmap_custom_char_next): Fix index computation -- indices start
with 0 and not with cmap->first.

Provide default charmaps.

* src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdriver.c
(PCF_Face_Init), src/pfr/pfrobjs.c (pfr_face_init),
src/type1/t1objs (T1_Face_Init), src/winfonts/winfnt.c
(FNT_Face_Init): Implement it.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2002-06-18  Detlef W�rkner  <[email protected]>
+
+	* src/psaux/t1cmap.c (t1_cmap_custom_char_index,
+	t1_cmap_custom_char_next): Fix index computation -- indices start
+	with 0 and not with cmap->first.
+
+	Provide default charmaps.
+
+	* src/bdf/bdfdrivr.c (BDF_Face_Init), src/pcf/pcfdriver.c
+	(PCF_Face_Init), src/pfr/pfrobjs.c (pfr_face_init),
+	src/type1/t1objs (T1_Face_Init), src/winfonts/winfnt.c
+	(FNT_Face_Init): Implement it.
+
 2002-06-17  Sven Neumann  <[email protected]>
 
 	* src/pfr/pfrobjs.c (pfr_face_init): Fix typo.
@@ -43,7 +56,7 @@
 
 2002-06-14  Detlef W�rkner  <[email protected]>
 
-	Add new cmap support to BDF driver
+	Add new cmap support to BDF driver.
 
 	* src/bdf/bdfdrivr.c (BDF_CMapRec) [FT_CONFIG_OPTION_USE_CMAPS]:
 	New structure.
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -448,6 +448,10 @@
               }
 
               error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL );
+
+              /* Select default charmap */
+              if (root->num_charmaps)
+                root->charmap = root->charmaps[0];
             }
 
 #else /* !FT_CONFIG_OPTION_USE_CMAPS */
@@ -481,11 +485,15 @@
 
 
           charmap.face        = FT_FACE( face );
-          charmap.encoding    = ft_encoding_none;
-          charmap.platform_id = 0;
+          charmap.encoding    = ft_encoding_adobe_standard;
+          charmap.platform_id = 7;
           charmap.encoding_id = 0;
 
           error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL );
+
+          /* Select default charmap */
+          if (root->num_charmaps)
+            root->charmap = root->charmaps[0];
         }
 
 #else /* !FT_CONFIG_OPTION_USE_CMAPS */
--- a/src/pcf/pcfdriver.c
+++ b/src/pcf/pcfdriver.c
@@ -340,6 +340,10 @@
         }
 
         error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );
+
+        /* Select default charmap */
+        if (face->root.num_charmaps)
+          face->root.charmap = face->root.charmaps[0];
       }
 
 #else  /* !FT_CONFIG_OPTION_USE_CMAPS */
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -175,6 +175,10 @@
          charmap.encoding    = ft_encoding_unicode;
          
          FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL );
+
+         /* Select default charmap */
+         if (root->num_charmaps)
+           root->charmap = root->charmaps[0];
        }
      }
 
--- a/src/psaux/t1cmap.c
+++ b/src/psaux/t1cmap.c
@@ -197,12 +197,11 @@
                              FT_UInt32      char_code )
   {
     FT_UInt    result = 0;
-    FT_UInt32  idx;
 
 
-    idx = (FT_UInt32)( char_code - cmap->first );
-    if ( idx < cmap->count )
-      result = cmap->indices[idx];
+    if ( ( char_code >= cmap->first )                  &&
+         ( char_code < ( cmap->first + cmap->count ) ) )
+      result = cmap->indices[char_code];
 
     return result;
   }
@@ -214,7 +213,6 @@
   {
     FT_UInt    result = 0;
     FT_UInt32  char_code = *pchar_code;
-    FT_UInt32  idx;
 
 
     ++char_code;
@@ -222,10 +220,9 @@
     if ( char_code < cmap->first )
       char_code = cmap->first;
 
-    idx = (FT_UInt32)( char_code - cmap->first );
-    for ( ; idx < cmap->count; idx++, char_code++ )
+    for ( ; char_code < ( cmap->first + cmap->count ); char_code++ )
     {
-      result = cmap->indices[idx];
+      result = cmap->indices[char_code];
       if ( result != 0 )
         goto Exit;
     }
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -485,6 +485,10 @@
 
         if ( clazz )
           FT_CMap_New( clazz, NULL, &charmap, NULL );
+
+        /* Select default charmap */
+        if (root->num_charmaps)
+          root->charmap = root->charmaps[0];
       }
     }
 
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -548,7 +548,12 @@
                              NULL,
                              &charmap,
                              NULL );
-        if (error) goto Fail;
+        if ( error )
+          goto Fail;
+
+        /* Select default charmap */
+        if ( root->num_charmaps )
+          root->charmap = root->charmaps[0];
       }
 
 #else /* !FT_CONFIG_OPTION_USE_CMAPS */