From 608e1e740e5e48f6e09904f24e799019e49b271e Mon Sep 17 00:00:00 2001 From: Pdf Bot Date: Wed, 6 Jul 2016 21:05:00 +0100 Subject: [PATCH] PDF.js version 1.5.318 - See mozilla/pdf.js@1f3f4a8dd723f452a5ecd69eb39e74388efc2e4c --- bower.json | 2 +- build/pdf.combined.js | 55 +++++++++++++++++++++++++------------------ build/pdf.js | 4 ++-- build/pdf.worker.js | 55 +++++++++++++++++++++++++------------------ package.json | 2 +- 5 files changed, 68 insertions(+), 50 deletions(-) diff --git a/bower.json b/bower.json index 4805f6656..28ed2e19a 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.5.316", + "version": "1.5.318", "main": [ "build/pdf.js", "build/pdf.worker.js" diff --git a/build/pdf.combined.js b/build/pdf.combined.js index d6c8437a1..03e80c939 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfCombined = {})); // Use strict in our context only - users might not want it 'use strict'; -var pdfjsVersion = '1.5.316'; -var pdfjsBuild = 'b9e9038'; +var pdfjsVersion = '1.5.318'; +var pdfjsBuild = '1f3f4a8'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? @@ -31808,6 +31808,25 @@ function getFontType(type, subtype) { } } +// Some bad PDF generators, e.g. Scribus PDF, include glyph names +// in a 'uniXXXX' format -- attempting to recover proper ones. +function recoverGlyphName(name, glyphsUnicodeMap) { + if (glyphsUnicodeMap[name] !== undefined) { + return name; + } + // The glyph name is non-standard, trying to recover. + var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap); + if (unicode !== -1) { + for (var key in glyphsUnicodeMap) { + if (glyphsUnicodeMap[key] === unicode) { + return key; + } + } + } + warn('Unable to recover a standard glyph name for: ' + name); + return name; +} + var Glyph = (function GlyphClosure() { function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { @@ -33889,26 +33908,6 @@ var Font = (function FontClosure() { return false; } - // Some bad PDF generators, e.g. Scribus PDF, include glyph names - // in a 'uniXXXX' format -- attempting to recover proper ones. - function recoverGlyphName(name, glyphsUnicodeMap) { - if (glyphsUnicodeMap[name] !== undefined) { - return name; - } - // The glyph name is non-standard, trying to recover. - var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap); - if (unicode !== -1) { - for (var key in glyphsUnicodeMap) { - if (glyphsUnicodeMap[key] === unicode) { - return key; - } - } - } - warn('Unable to recover a standard glyph name for: ' + name); - return name; - } - - if (properties.type === 'CIDFontType2') { var cidToGidMap = properties.cidToGidMap || []; var isCidToGidMapEmpty = cidToGidMap.length === 0; @@ -34482,11 +34481,21 @@ function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { } // Lastly, merge in the differences. - var differences = properties.differences; + var differences = properties.differences, glyphsUnicodeMap; if (differences) { for (charCode in differences) { var glyphName = differences[charCode]; glyphId = glyphNames.indexOf(glyphName); + + if (glyphId === -1) { + if (!glyphsUnicodeMap) { + glyphsUnicodeMap = getGlyphsUnicode(); + } + var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); + if (standardGlyphName !== glyphName) { + glyphId = glyphNames.indexOf(standardGlyphName); + } + } if (glyphId >= 0) { charCodeToGlyphId[charCode] = glyphId; } else { diff --git a/build/pdf.js b/build/pdf.js index 68898a4ab..1fa49992d 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {})); // Use strict in our context only - users might not want it 'use strict'; -var pdfjsVersion = '1.5.316'; -var pdfjsBuild = 'b9e9038'; +var pdfjsVersion = '1.5.318'; +var pdfjsBuild = '1f3f4a8'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? diff --git a/build/pdf.worker.js b/build/pdf.worker.js index e6e780619..eb8c3ff13 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {})); // Use strict in our context only - users might not want it 'use strict'; -var pdfjsVersion = '1.5.316'; -var pdfjsBuild = 'b9e9038'; +var pdfjsVersion = '1.5.318'; +var pdfjsBuild = '1f3f4a8'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? @@ -27944,6 +27944,25 @@ function getFontType(type, subtype) { } } +// Some bad PDF generators, e.g. Scribus PDF, include glyph names +// in a 'uniXXXX' format -- attempting to recover proper ones. +function recoverGlyphName(name, glyphsUnicodeMap) { + if (glyphsUnicodeMap[name] !== undefined) { + return name; + } + // The glyph name is non-standard, trying to recover. + var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap); + if (unicode !== -1) { + for (var key in glyphsUnicodeMap) { + if (glyphsUnicodeMap[key] === unicode) { + return key; + } + } + } + warn('Unable to recover a standard glyph name for: ' + name); + return name; +} + var Glyph = (function GlyphClosure() { function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { @@ -30025,26 +30044,6 @@ var Font = (function FontClosure() { return false; } - // Some bad PDF generators, e.g. Scribus PDF, include glyph names - // in a 'uniXXXX' format -- attempting to recover proper ones. - function recoverGlyphName(name, glyphsUnicodeMap) { - if (glyphsUnicodeMap[name] !== undefined) { - return name; - } - // The glyph name is non-standard, trying to recover. - var unicode = getUnicodeForGlyph(name, glyphsUnicodeMap); - if (unicode !== -1) { - for (var key in glyphsUnicodeMap) { - if (glyphsUnicodeMap[key] === unicode) { - return key; - } - } - } - warn('Unable to recover a standard glyph name for: ' + name); - return name; - } - - if (properties.type === 'CIDFontType2') { var cidToGidMap = properties.cidToGidMap || []; var isCidToGidMapEmpty = cidToGidMap.length === 0; @@ -30618,11 +30617,21 @@ function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { } // Lastly, merge in the differences. - var differences = properties.differences; + var differences = properties.differences, glyphsUnicodeMap; if (differences) { for (charCode in differences) { var glyphName = differences[charCode]; glyphId = glyphNames.indexOf(glyphName); + + if (glyphId === -1) { + if (!glyphsUnicodeMap) { + glyphsUnicodeMap = getGlyphsUnicode(); + } + var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); + if (standardGlyphName !== glyphName) { + glyphId = glyphNames.indexOf(standardGlyphName); + } + } if (glyphId >= 0) { charCodeToGlyphId[charCode] = glyphId; } else { diff --git a/package.json b/package.json index 8a9086227..ade576bbf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.5.316", + "version": "1.5.318", "main": "build/pdf.js", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [