From 0ae7d5352648d8b1a80983fa80c35a691bf79e00 Mon Sep 17 00:00:00 2001 From: Kalervo Kujala Date: Thu, 12 Jan 2012 21:05:12 +0200 Subject: [PATCH 1/9] Fix Makefile to remove all_files.tmp properly. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e9c2cc370..c9de61c1c 100644 --- a/Makefile +++ b/Makefile @@ -71,7 +71,7 @@ bundle: | $(BUILD_DIR) cat $(PDF_JS_FILES) > all_files.tmp; \ sed '/PDFJSSCRIPT_INCLUDE_ALL/ r all_files.tmp' pdf.js > ../$(BUILD_TARGET); \ sed -i.bak "s/PDFJSSCRIPT_BUNDLE_VER/`git log --format="%h" -n 1`/" ../$(BUILD_TARGET); \ - rm -f ../$(BUILD_TARGET).bak + rm -f ../$(BUILD_TARGET).bak; \ rm -f *.tmp; \ cd .. From 2004246f752825816dfaa187a6367d3a47a5cc01 Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Sat, 14 Jan 2012 13:24:02 -0600 Subject: [PATCH 2/9] Change the identifier --- test/test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test.py b/test/test.py index 888bd9ce8..84c6498ce 100644 --- a/test/test.py +++ b/test/test.py @@ -9,7 +9,7 @@ USAGE_EXAMPLE = "%prog" # The local web server uses the git repo as the document root. DOC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),"..")) -ANAL = True +GIT_CLONE_CHECK = True DEFAULT_MANIFEST_FILE = 'test_manifest.json' EQLOG_FILE = 'eq.log' BROWSERLOG_FILE = 'browser.log' @@ -344,7 +344,7 @@ def verifyPDFs(manifestList): def setUp(options): # Only serve files from a pdf.js clone - assert not ANAL or os.path.isfile('../src/pdf.js') and os.path.isdir('../.git') + assert not GIT_CLONE_CHECK or os.path.isfile('../src/pdf.js') and os.path.isdir('../.git') if options.masterMode and os.path.isdir(TMPDIR): print 'Temporary snapshot dir tmp/ is still around.' From 9eaf746a33bda8511d60ab5d3315d3a57d0c9af2 Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Sun, 15 Jan 2012 14:01:36 -0600 Subject: [PATCH 3/9] Replace makeCssRgb.apply with direct call (avoiding Chrome 16 typed array issue) --- src/pattern.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pattern.js b/src/pattern.js index dbe2e5c23..dff2a5b44 100644 --- a/src/pattern.js +++ b/src/pattern.js @@ -94,9 +94,9 @@ Shadings.RadialAxial = (function RadialAxialClosure() { var colorStops = []; for (var i = t0; i <= t1; i += step) { - var color = fn([i]); - var rgbColor = Util.makeCssRgb.apply(this, cs.getRgb(color)); - colorStops.push([(i - t0) / diff, rgbColor]); + var rgbColor = cs.getRgb(fn([i])); + var cssColor = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]); + colorStops.push([(i - t0) / diff, cssColor]); } this.colorStops = colorStops; @@ -234,9 +234,9 @@ var TilingPattern = (function TilingPatternClosure() { tmpCtx.strokeStyle = ctx.strokeStyle; break; case PaintType.UNCOLORED: - color = Util.makeCssRgb.apply(this, color); - tmpCtx.fillStyle = color; - tmpCtx.strokeStyle = color; + var cssColor = Util.makeCssRgb(this, color[0], color[1], color[2]); + tmpCtx.fillStyle = cssColor; + tmpCtx.strokeStyle = cssColor; break; default: error('Unsupported paint type: ' + paintType); From 8b52b50c677497127b1502aba67f380ff46a1c06 Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Sun, 15 Jan 2012 15:19:51 -0600 Subject: [PATCH 4/9] Use .sheet property instead of document.styleSheets --- src/fonts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fonts.js b/src/fonts.js index 329d7ad77..d0ff7664d 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -2121,10 +2121,11 @@ var Font = (function FontClosure() { window.btoa(data) + ');'); var rule = "@font-face { font-family:'" + fontName + "';src:" + url + '}'; + var styleElement = document.createElement('style'); document.documentElement.getElementsByTagName('head')[0].appendChild( - document.createElement('style')); + styleElement); - var styleSheet = document.styleSheets[document.styleSheets.length - 1]; + var styleSheet = styleElement.sheet; styleSheet.insertRule(rule, styleSheet.cssRules.length); return rule; From 1bb55923577e42c33e36e78a5f73fa19d24d7c1a Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Mon, 16 Jan 2012 11:53:59 -0600 Subject: [PATCH 5/9] Replace makeCssRgb.apply in setStrokeColor and setFillColor --- src/canvas.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/canvas.js b/src/canvas.js index 0ad02dc24..4feac4efe 100644 --- a/src/canvas.js +++ b/src/canvas.js @@ -832,8 +832,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { }, setStrokeColor: function canvasGraphicsSetStrokeColor(/*...*/) { var cs = this.current.strokeColorSpace; - var color = cs.getRgb(arguments); - var color = Util.makeCssRgb.apply(null, cs.getRgb(arguments)); + var rgbColor = cs.getRgb(arguments); + var color = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]); this.ctx.strokeStyle = color; this.current.strokeColor = color; }, @@ -870,7 +870,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { }, setFillColor: function canvasGraphicsSetFillColor(/*...*/) { var cs = this.current.fillColorSpace; - var color = Util.makeCssRgb.apply(null, cs.getRgb(arguments)); + var rgbColor = cs.getRgb(arguments); + var color = Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]); this.ctx.fillStyle = color; this.current.fillColor = color; }, From 85a0eccc7e3122ebacbc05d3bb5f7e6c9be60d68 Mon Sep 17 00:00:00 2001 From: notmasteryet Date: Mon, 16 Jan 2012 18:10:48 -0600 Subject: [PATCH 6/9] Fallback map of the "non-standard" fonts --- src/fonts.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/fonts.js b/src/fonts.js index 329d7ad77..ea740fecf 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -339,6 +339,21 @@ var stdFontMap = { 'TimesNewRomanPSMT-Italic': 'Times-Italic' }; +/** + * Holds the map of the non-standard fonts that might be included as a standard + * fonts without glyph data. + */ +var nonStdFontMap = { + 'ComicSansMS': 'Comic Sans MS', + 'ComicSansMS-Bold': 'Comic Sans MS-Bold', + 'ComicSansMS-BoldItalic': 'Comic Sans MS-BoldItalic', + 'ComicSansMS-Italic': 'Comic Sans MS-Italic', + 'LucidaConsole': 'Courier', + 'LucidaConsole-Bold': 'Courier-Bold', + 'LucidaConsole-BoldItalic': 'Courier-BoldOblique', + 'LucidaConsole-Italic': 'Courier-Oblique' +}; + var serifFonts = { 'Adobe Jenson': true, 'Adobe Text': true, 'Albertus': true, 'Aldus': true, 'Alexandria': true, 'Algerian': true, @@ -785,7 +800,7 @@ var Font = (function FontClosure() { // The file data is not specified. Trying to fix the font name // to be used with the canvas.font. var fontName = name.replace(/[,_]/g, '-'); - fontName = stdFontMap[fontName] || fontName; + fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; this.bold = (fontName.search(/bold/gi) != -1); this.italic = (fontName.search(/oblique/gi) != -1) || From 06c4c83edf65eb7a62d70d68b3f0614824c3f31b Mon Sep 17 00:00:00 2001 From: Artur Adib Date: Tue, 17 Jan 2012 14:40:52 -0500 Subject: [PATCH 7/9] Fixes #1055 by falling back to page resources --- src/evaluator.js | 8 ++++---- test/test_manifest.json | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/evaluator.js b/src/evaluator.js index 60ab66560..7916b50c8 100644 --- a/src/evaluator.js +++ b/src/evaluator.js @@ -292,8 +292,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { // Create an IR of the pattern code. var depIdx = dependencyArray.length; var queueObj = {}; - var codeIR = this.getIRQueue(pattern, dict.get('Resources'), - queueObj, dependencyArray); + var codeIR = this.getIRQueue(pattern, dict.get('Resources') + || resources, queueObj, dependencyArray); // Add the dependencies that are required to execute the // codeIR. @@ -336,8 +336,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { // This adds the IRQueue of the xObj to the current queue. var depIdx = dependencyArray.length; - this.getIRQueue(xobj, xobj.dict.get('Resources'), queue, - dependencyArray); + this.getIRQueue(xobj, xobj.dict.get('Resources') || resources, + queue, dependencyArray); // Add the dependencies that are required to execute the // codeIR. diff --git a/test/test_manifest.json b/test/test_manifest.json index 8598e4bc8..fa7ec7123 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -403,5 +403,12 @@ "pageLimit": 3, "link": true, "type": "load" + }, + { "id": "issue1055", + "file": "pdfs/issue1055.pdf", + "md5": "3ba56c2e48dce81da8669b1b9cf98ff0", + "rounds": 1, + "link": true, + "type": "eq" } ] From a6f62fc45a4edc75c86593aa9811fe720f570602 Mon Sep 17 00:00:00 2001 From: Artur Adib Date: Tue, 17 Jan 2012 14:44:35 -0500 Subject: [PATCH 8/9] Missing file --- test/pdfs/issue1055.pdf.link | 1 + 1 file changed, 1 insertion(+) create mode 100644 test/pdfs/issue1055.pdf.link diff --git a/test/pdfs/issue1055.pdf.link b/test/pdfs/issue1055.pdf.link new file mode 100644 index 000000000..8e2e7107c --- /dev/null +++ b/test/pdfs/issue1055.pdf.link @@ -0,0 +1 @@ +http://mcpherrin.ca/code/mozilla/engl208b.pdf From f97bc8df6ff09760e1d8c10fc0a5806d769079fa Mon Sep 17 00:00:00 2001 From: Artur Adib Date: Tue, 17 Jan 2012 14:45:57 -0500 Subject: [PATCH 9/9] Lint --- src/evaluator.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/evaluator.js b/src/evaluator.js index 7916b50c8..21530f42f 100644 --- a/src/evaluator.js +++ b/src/evaluator.js @@ -292,8 +292,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { // Create an IR of the pattern code. var depIdx = dependencyArray.length; var queueObj = {}; - var codeIR = this.getIRQueue(pattern, dict.get('Resources') - || resources, queueObj, dependencyArray); + var codeIR = this.getIRQueue(pattern, dict.get('Resources') || + resources, queueObj, dependencyArray); // Add the dependencies that are required to execute the // codeIR. @@ -336,7 +336,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { // This adds the IRQueue of the xObj to the current queue. var depIdx = dependencyArray.length; - this.getIRQueue(xobj, xobj.dict.get('Resources') || resources, + this.getIRQueue(xobj, xobj.dict.get('Resources') || resources, queue, dependencyArray); // Add the dependencies that are required to execute the