]> git.parisson.com Git - pdf.js.git/commitdiff
First pass CIDFont - stop CID fonts breaking PDF rendering
authorAdil Allawi <adil@diwan.com>
Tue, 5 Jul 2011 11:47:15 +0000 (12:47 +0100)
committerAdil Allawi <adil@diwan.com>
Mon, 11 Jul 2011 16:41:55 +0000 (17:41 +0100)
pdf.js

diff --git a/pdf.js b/pdf.js
index c450b6ddddf066af615609b6fb8b9c8c0643897a..9dddd8210e2e9e90b44dfbfd562f2f9965e51351 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -3626,9 +3626,17 @@ var PartialEvaluator = (function() {
     translateFont: function(fontDict, xref, resources) {
       var fd = fontDict.get('FontDescriptor');
       if (!fd)
-        // XXX deprecated "special treatment" for standard
-        // fonts?  What do we need to do here?
-        return null;
+      {
+        //If font is a composite get the FontDescriptor from the descendant
+        var df = fontDict.get("DescendantFonts");
+        if (!df)
+          return null;
+        var descendant = xref.fetch(df[0]);
+        fd = descendant.get("FontDescriptor");
+        if (!fd)
+          return null;
+        fontDict.set("FontDescriptor", fd);
+      }
       var descriptor = xref.fetch(fd);
 
       var fontName = descriptor.get('FontName');
@@ -3674,6 +3682,7 @@ var PartialEvaluator = (function() {
           }
         } else if (IsName(encoding)) {
           var encoding = Encodings[encoding.name];
+          //XXX CIDFont support - get the CID Encoding especially support japan1 and identity
           if (!encoding)
             error('Unknown font encoding');