Commit 3b6c71ee245660a42b8f99d53ba5a51dc1b84666

David Turner 2006-02-23T22:57:31

additionnal backwards-compatibility hacks

diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index 71944b8..6f1b8ea 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -316,8 +316,40 @@
           query.char_code  = (FT_UInt32)cmap_index;
           break;
 
+        case FTC_OLD_CMAP_BY_ENCODING:
+        case FTC_OLD_CMAP_BY_ID:
+          {
+            FT_Face  face;
+            FT_Int   nn;
+
+            error = FTC_Manager_LookupFace( cache->manager, desc->face_id,
+                                            &face );
+            if ( error )
+              return error;
+
+            if ( desc->type == FTC_OLD_CMAP_BY_ENCODING )
+            {
+              for ( nn = 0; nn < face->num_charmaps; nn++ )
+                if ( face->charmaps[nn]->encoding == desc->u.encoding )
+                  break;
+            }
+            else
+            {
+              for ( nn = 0; nn < face->num_charmaps; nn++ )
+                if ( face->charmaps[nn]->platform_id == desc->u.id.platform &&
+                     face->charmaps[nn]->encoding_id == desc->u.id.encoding )
+                   break;
+            }
+
+            if ( nn >= face->num_charmaps )
+              return 0;
+
+            query.cmap_index = (FT_UInt)nn;
+          }
+          break;
+
         default:
-          return FT_Err_Unimplemented_Feature;
+          return 0;
       }
     }
     else