From 44e067d10495b709e5b0c171c68110852ee4da47 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Mon, 22 Sep 2014 16:30:59 -0500 Subject: [PATCH] PDF.js version 1.0.587 --- bower.json | 2 +- build/pdf.combined.js | 56 ++++++++++++++++++++++++++++--------------- build/pdf.js | 4 ++-- build/pdf.worker.js | 56 ++++++++++++++++++++++++++++--------------- package.json | 2 +- 5 files changed, 78 insertions(+), 42 deletions(-) diff --git a/bower.json b/bower.json index daccd4e3f..7968336c2 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.0.584", + "version": "1.0.587", "keywords": [ "Mozilla", "pdf", diff --git a/build/pdf.combined.js b/build/pdf.combined.js index cb546142e..460e33025 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.0.584'; -PDFJS.build = '2b87ff9'; +PDFJS.version = '1.0.587'; +PDFJS.build = 'fa53fcb'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -22616,6 +22616,7 @@ var Font = (function FontClosure() { if (!properties.composite /* is simple font */) { toUnicode = []; var encoding = properties.defaultEncoding.slice(); + var baseEncodingName = properties.baseEncodingName; // Merge in the differences array. var differences = properties.differences; for (charcode in differences) { @@ -22626,26 +22627,43 @@ var Font = (function FontClosure() { var glyphName = encoding[charcode]; // b) Look up the character name in the Adobe Glyph List (see the // Bibliography) to obtain the corresponding Unicode value. - if (glyphName === '' || !(glyphName in GlyphsUnicode)) { + if (glyphName === '') { + continue; + } else if (GlyphsUnicode[glyphName] === undefined) { // (undocumented) c) Few heuristics to recognize unknown glyphs // NOTE: Adobe Reader does not do this step, but OSX Preview does - var code; - // Gxx glyph - if (glyphName.length === 3 && - glyphName[0] === 'G' && - (code = parseInt(glyphName.substr(1), 16))) { - toUnicode[charcode] = String.fromCharCode(code); - } - // g00xx glyph - if (glyphName.length === 5 && - glyphName[0] === 'g' && - (code = parseInt(glyphName.substr(1), 16))) { - toUnicode[charcode] = String.fromCharCode(code); + var code = 0; + switch (glyphName[0]) { + case 'G': // Gxx glyph + if (glyphName.length === 3) { + code = parseInt(glyphName.substr(1), 16); + } + break; + case 'g': // g00xx glyph + if (glyphName.length === 5) { + code = parseInt(glyphName.substr(1), 16); + } + break; + case 'C': // Cddd glyph + case 'c': // cddd glyph + if (glyphName.length >= 3) { + code = +glyphName.substr(1); + } + break; } - // Cddd glyph - if (glyphName.length >= 3 && - glyphName[0] === 'C' && - (code = +glyphName.substr(1))) { + if (code) { + // If |baseEncodingName| is one the predefined encodings, + // and |code| equals |charcode|, using the glyph defined in the + // baseEncoding seems to yield a better |toUnicode| mapping + // (fixes issue 5070). + if (baseEncodingName && code === +charcode) { + var baseEncoding = Encodings[baseEncodingName]; + if (baseEncoding && (glyphName = baseEncoding[charcode])) { + toUnicode[charcode] = + String.fromCharCode(GlyphsUnicode[glyphName]); + continue; + } + } toUnicode[charcode] = String.fromCharCode(code); } continue; diff --git a/build/pdf.js b/build/pdf.js index 3eb8eb950..afec18974 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.0.584'; -PDFJS.build = '2b87ff9'; +PDFJS.version = '1.0.587'; +PDFJS.build = 'fa53fcb'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it diff --git a/build/pdf.worker.js b/build/pdf.worker.js index 49e1c8105..cc917ace7 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.0.584'; -PDFJS.build = '2b87ff9'; +PDFJS.version = '1.0.587'; +PDFJS.build = 'fa53fcb'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -17759,6 +17759,7 @@ var Font = (function FontClosure() { if (!properties.composite /* is simple font */) { toUnicode = []; var encoding = properties.defaultEncoding.slice(); + var baseEncodingName = properties.baseEncodingName; // Merge in the differences array. var differences = properties.differences; for (charcode in differences) { @@ -17769,26 +17770,43 @@ var Font = (function FontClosure() { var glyphName = encoding[charcode]; // b) Look up the character name in the Adobe Glyph List (see the // Bibliography) to obtain the corresponding Unicode value. - if (glyphName === '' || !(glyphName in GlyphsUnicode)) { + if (glyphName === '') { + continue; + } else if (GlyphsUnicode[glyphName] === undefined) { // (undocumented) c) Few heuristics to recognize unknown glyphs // NOTE: Adobe Reader does not do this step, but OSX Preview does - var code; - // Gxx glyph - if (glyphName.length === 3 && - glyphName[0] === 'G' && - (code = parseInt(glyphName.substr(1), 16))) { - toUnicode[charcode] = String.fromCharCode(code); - } - // g00xx glyph - if (glyphName.length === 5 && - glyphName[0] === 'g' && - (code = parseInt(glyphName.substr(1), 16))) { - toUnicode[charcode] = String.fromCharCode(code); + var code = 0; + switch (glyphName[0]) { + case 'G': // Gxx glyph + if (glyphName.length === 3) { + code = parseInt(glyphName.substr(1), 16); + } + break; + case 'g': // g00xx glyph + if (glyphName.length === 5) { + code = parseInt(glyphName.substr(1), 16); + } + break; + case 'C': // Cddd glyph + case 'c': // cddd glyph + if (glyphName.length >= 3) { + code = +glyphName.substr(1); + } + break; } - // Cddd glyph - if (glyphName.length >= 3 && - glyphName[0] === 'C' && - (code = +glyphName.substr(1))) { + if (code) { + // If |baseEncodingName| is one the predefined encodings, + // and |code| equals |charcode|, using the glyph defined in the + // baseEncoding seems to yield a better |toUnicode| mapping + // (fixes issue 5070). + if (baseEncodingName && code === +charcode) { + var baseEncoding = Encodings[baseEncodingName]; + if (baseEncoding && (glyphName = baseEncoding[charcode])) { + toUnicode[charcode] = + String.fromCharCode(GlyphsUnicode[glyphName]); + continue; + } + } toUnicode[charcode] = String.fromCharCode(code); } continue; diff --git a/package.json b/package.json index 758091ad6..037cfaf05 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.0.584", + "version": "1.0.587", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [ "Mozilla",