]> git.parisson.com Git - pdf.js.git/commitdiff
Fix invalid arguments error.
authorBrendan Dahl <brendan.dahl@gmail.com>
Tue, 29 Nov 2011 22:50:19 +0000 (14:50 -0800)
committerBrendan Dahl <brendan.dahl@gmail.com>
Tue, 29 Nov 2011 22:50:19 +0000 (14:50 -0800)
src/core.js
src/evaluator.js

index 3549eb906b6795d70d99572494a2351c66373bbf..a3485b3e0dbdb94a651f67c29dc244f2d156e1ab 100644 (file)
@@ -558,20 +558,9 @@ var PDFDoc = (function pdfDoc() {
             var properties = data[4];
 
             if (file) {
+              // Rewrap the ArrayBuffer in a stream.
               var fontFileDict = new Dict();
-              fontFileDict.map = file.dict.map;
-
-              var fontFile = new Stream(file.bytes, file.start,
-                                        file.end - file.start, fontFileDict);
-
-              // Check if this is a FlateStream. Otherwise just use the created
-              // Stream one. This makes complex_ttf_font.pdf work.
-              var cmf = file.bytes[0];
-              if ((cmf & 0x0f) == 0x08) {
-                file = new FlateStream(fontFile);
-              } else {
-                file = fontFile;
-              }
+              file = new Stream(file, 0, file.length, fontFileDict);
             }
 
             // For now, resolve the font object here direclty. The real font
index 3e687c72d181a90aa6f6fd9a2295f87d78dcff6d..b6ef4ddfa2256b91787f6b6f1b0933c1fc56e1f3 100644 (file)
@@ -155,6 +155,11 @@ var PartialEvaluator = (function partialEvaluator() {
             font.loadedName = loadedName;
 
             var translated = font.translated;
+            // Convert the file to an ArrayBuffer which will be turned back into
+            // a Stream in the main thread.
+            if (translated.file)
+              translated.file = translated.file.getBytes();
+
             handler.send('obj', [
                 loadedName,
                 'Font',