]> git.parisson.com Git - pdf.js.git/commitdiff
Let handleSetFont use a fontRef directly. Fixes extgstate.pdf
authorJulian Viereck <julian.viereck@gmail.com>
Sun, 9 Oct 2011 11:31:13 +0000 (13:31 +0200)
committerJulian Viereck <julian.viereck@gmail.com>
Sun, 9 Oct 2011 11:36:25 +0000 (13:36 +0200)
pdf.js

diff --git a/pdf.js b/pdf.js
index d5a15d091b6ce4311b64e3556f70bbd58c1d76d2..b76625c7923f57ce3f233e6e024e77b92a031d26 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -4691,13 +4691,14 @@ var PartialEvaluator = (function partialEvaluator() {
       }
 
       var self = this;
-      function handleSetFont(fontName) {
+      function handleSetFont(fontName, fontRef) {
         var loadedName = null;
 
         var fontRes = resources.get('Font');
         if (fontRes) {
           fontRes = xref.fetchIfRef(fontRes);
-          var font = xref.fetchIfRef(fontRes.get(fontName));
+          fontRef = fontRef || fontRes.get(fontName);
+          var font = xref.fetchIfRef(fontRef);
           assertWellFormed(isDict(font));
           if (!font.translated) {
             font.translated = self.translateFont(font, xref, resources, handler,
@@ -4984,7 +4985,10 @@ var PartialEvaluator = (function partialEvaluator() {
                   case 'Font':
                     gsStateObj.push([
                       'Font',
-                      handleSetFont(value[0]), value[1]
+                      // isRef(value[0]) === true -> pass in as ref and not as
+                      // font name.
+                      handleSetFont(null, value[0]),
+                      value[1]
                     ]);
                     break;
                   case 'OP':