Browse Source

PDF.js version 2.0.489 - See mozilla/pdf.js@7d7bc80eee7ef4486547bec7b3ecba7be7aabc69

master v2.0.489
pdfjsbot 7 years ago
parent
commit
75d0c0c6a5
  1. 2
      bower.json
  2. 12
      build/pdf.js
  3. 2
      build/pdf.js.map
  4. 2
      build/pdf.min.js
  5. 67
      build/pdf.worker.js
  6. 2
      build/pdf.worker.js.map
  7. 2
      build/pdf.worker.min.js
  8. 59
      lib/core/font_renderer.js
  9. 2
      lib/core/worker.js
  10. 6
      lib/display/api.js
  11. 4
      lib/pdf.js
  12. 4
      lib/pdf.worker.js
  13. 4
      lib/web/pdf_viewer.component.js
  14. 2
      package.json
  15. 4
      web/pdf_viewer.js
  16. 2
      web/pdf_viewer.js.map

2
bower.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "2.0.487", "version": "2.0.489",
"main": [ "main": [
"build/pdf.js", "build/pdf.js",
"build/pdf.worker.js" "build/pdf.worker.js"

12
build/pdf.js

@ -1518,7 +1518,7 @@ if (typeof __g == 'number') __g = global;
"use strict"; "use strict";
var core = module.exports = { version: '2.5.4' }; var core = module.exports = { version: '2.5.5' };
if (typeof __e == 'number') __e = core; if (typeof __e == 'number') __e = core;
/***/ }), /***/ }),
@ -3003,8 +3003,8 @@ exports.GlobalWorkerOptions = GlobalWorkerOptions;
"use strict"; "use strict";
var pdfjsVersion = '2.0.487'; var pdfjsVersion = '2.0.489';
var pdfjsBuild = '2275485c'; var pdfjsBuild = '7d7bc80e';
var pdfjsSharedUtil = __w_pdfjs_require__(0); var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayAPI = __w_pdfjs_require__(117); var pdfjsDisplayAPI = __w_pdfjs_require__(117);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(125); var pdfjsDisplayTextLayer = __w_pdfjs_require__(125);
@ -8437,7 +8437,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
} }
return worker.messageHandler.sendWithPromise('GetDocRequest', { return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId: docId, docId: docId,
apiVersion: '2.0.487', apiVersion: '2.0.489',
source: { source: {
data: source.data, data: source.data,
url: source.url, url: source.url,
@ -9855,8 +9855,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}(); }();
var version, build; var version, build;
{ {
exports.version = version = '2.0.487'; exports.version = version = '2.0.489';
exports.build = build = '2275485c'; exports.build = build = '7d7bc80e';
} }
exports.getDocument = getDocument; exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort; exports.LoopbackPort = LoopbackPort;

2
build/pdf.js.map

File diff suppressed because one or more lines are too long

2
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

67
build/pdf.worker.js vendored

@ -2759,7 +2759,7 @@ if (typeof __g == 'number') __g = global;
"use strict"; "use strict";
var core = module.exports = { version: '2.5.4' }; var core = module.exports = { version: '2.5.5' };
if (typeof __e == 'number') __e = core; if (typeof __e == 'number') __e = core;
/***/ }), /***/ }),
@ -22360,8 +22360,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict"; "use strict";
var pdfjsVersion = '2.0.487'; var pdfjsVersion = '2.0.489';
var pdfjsBuild = '2275485c'; var pdfjsBuild = '7d7bc80e';
var pdfjsCoreWorker = __w_pdfjs_require__(74); var pdfjsCoreWorker = __w_pdfjs_require__(74);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -22574,7 +22574,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null; var cancelXHRs = null;
var WorkerTasks = []; var WorkerTasks = [];
var apiVersion = docParams.apiVersion; var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.487'; var workerVersion = '2.0.489';
if (apiVersion !== null && apiVersion !== workerVersion) { if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".')); throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
} }
@ -38934,7 +38934,10 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
return { return {
glyphs: cff.charStrings.objects, glyphs: cff.charStrings.objects,
subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects, subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
isCFFCIDFont: cff.isCIDFont,
fdSelect: cff.fdSelect,
fdArray: cff.fdArray
}; };
} }
function parseGlyfTable(glyf, loca, isGlyphLocationsLong) { function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
@ -39138,7 +39141,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
} }
} }
} }
function compileCharString(code, cmds, font) { function compileCharString(code, cmds, font, glyphId) {
var stack = []; var stack = [];
var x = 0, var x = 0,
y = 0; y = 0;
@ -39222,8 +39225,27 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
} }
break; break;
case 10: case 10:
n = stack.pop() + font.subrsBias; n = stack.pop();
subrCode = font.subrs[n]; subrCode = null;
if (font.isCFFCIDFont) {
var fdIndex = font.fdSelect.getFDIndex(glyphId);
if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
var fontDict = font.fdArray[fdIndex],
subrs = void 0;
if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
subrs = fontDict.privateDict.subrsIndex.objects;
}
if (subrs) {
var numSubrs = subrs.length;
n += numSubrs < 1240 ? 107 : numSubrs < 33900 ? 1131 : 32768;
subrCode = subrs[n];
}
} else {
(0, _util.warn)('Invalid fd index for glyph index.');
}
} else {
subrCode = font.subrs[n + font.subrsBias];
}
if (subrCode) { if (subrCode) {
parse(subrCode); parse(subrCode);
} }
@ -39313,10 +39335,10 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
args: [x, y] args: [x, y]
}); });
var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]])); var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
compileCharString(font.glyphs[cmap.glyphId], cmds, font); compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
cmds.push({ cmd: 'restore' }); cmds.push({ cmd: 'restore' });
cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]])); cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
compileCharString(font.glyphs[cmap.glyphId], cmds, font); compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
} }
return; return;
case 18: case 18:
@ -39491,7 +39513,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
var cmap = lookupCmap(this.cmap, unicode); var cmap = lookupCmap(this.cmap, unicode);
var fn = this.compiledGlyphs[cmap.glyphId]; var fn = this.compiledGlyphs[cmap.glyphId];
if (!fn) { if (!fn) {
fn = this.compileGlyph(this.glyphs[cmap.glyphId]); fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
this.compiledGlyphs[cmap.glyphId] = fn; this.compiledGlyphs[cmap.glyphId] = fn;
} }
if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) { if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
@ -39499,21 +39521,31 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
} }
return fn; return fn;
}, },
compileGlyph: function compileGlyph(code) { compileGlyph: function compileGlyph(code, glyphId) {
if (!code || code.length === 0 || code[0] === 14) { if (!code || code.length === 0 || code[0] === 14) {
return noop; return noop;
} }
var fontMatrix = this.fontMatrix;
if (this.isCFFCIDFont) {
var fdIndex = this.fdSelect.getFDIndex(glyphId);
if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
var fontDict = this.fdArray[fdIndex];
fontMatrix = fontDict.getByName('FontMatrix') || _util.FONT_IDENTITY_MATRIX;
} else {
(0, _util.warn)('Invalid fd index for glyph index.');
}
}
var cmds = []; var cmds = [];
cmds.push({ cmd: 'save' }); cmds.push({ cmd: 'save' });
cmds.push({ cmds.push({
cmd: 'transform', cmd: 'transform',
args: this.fontMatrix.slice() args: fontMatrix.slice()
}); });
cmds.push({ cmds.push({
cmd: 'scale', cmd: 'scale',
args: ['size', '-size'] args: ['size', '-size']
}); });
this.compileGlyphImpl(code, cmds); this.compileGlyphImpl(code, cmds, glyphId);
cmds.push({ cmd: 'restore' }); cmds.push({ cmd: 'restore' });
return cmds; return cmds;
}, },
@ -39546,10 +39578,13 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)(); this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768; this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768; this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
this.isCFFCIDFont = cffInfo.isCFFCIDFont;
this.fdSelect = cffInfo.fdSelect;
this.fdArray = cffInfo.fdArray;
} }
_util.Util.inherit(Type2Compiled, CompiledFont, { _util.Util.inherit(Type2Compiled, CompiledFont, {
compileGlyphImpl: function compileGlyphImpl(code, cmds) { compileGlyphImpl: function compileGlyphImpl(code, cmds, glyphId) {
compileCharString(code, cmds, this); compileCharString(code, cmds, this, glyphId);
} }
}); });
return { return {

2
build/pdf.worker.js.map vendored

File diff suppressed because one or more lines are too long

2
build/pdf.worker.min.js vendored

File diff suppressed because one or more lines are too long

59
lib/core/font_renderer.js

@ -98,7 +98,10 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
return { return {
glyphs: cff.charStrings.objects, glyphs: cff.charStrings.objects,
subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects, subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
isCFFCIDFont: cff.isCIDFont,
fdSelect: cff.fdSelect,
fdArray: cff.fdArray
}; };
} }
function parseGlyfTable(glyf, loca, isGlyphLocationsLong) { function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
@ -302,7 +305,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
} }
} }
} }
function compileCharString(code, cmds, font) { function compileCharString(code, cmds, font, glyphId) {
var stack = []; var stack = [];
var x = 0, var x = 0,
y = 0; y = 0;
@ -386,8 +389,27 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
} }
break; break;
case 10: case 10:
n = stack.pop() + font.subrsBias; n = stack.pop();
subrCode = font.subrs[n]; subrCode = null;
if (font.isCFFCIDFont) {
var fdIndex = font.fdSelect.getFDIndex(glyphId);
if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
var fontDict = font.fdArray[fdIndex],
subrs = void 0;
if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
subrs = fontDict.privateDict.subrsIndex.objects;
}
if (subrs) {
var numSubrs = subrs.length;
n += numSubrs < 1240 ? 107 : numSubrs < 33900 ? 1131 : 32768;
subrCode = subrs[n];
}
} else {
(0, _util.warn)('Invalid fd index for glyph index.');
}
} else {
subrCode = font.subrs[n + font.subrsBias];
}
if (subrCode) { if (subrCode) {
parse(subrCode); parse(subrCode);
} }
@ -477,10 +499,10 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
args: [x, y] args: [x, y]
}); });
var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]])); var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
compileCharString(font.glyphs[cmap.glyphId], cmds, font); compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
cmds.push({ cmd: 'restore' }); cmds.push({ cmd: 'restore' });
cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]])); cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
compileCharString(font.glyphs[cmap.glyphId], cmds, font); compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
} }
return; return;
case 18: case 18:
@ -655,7 +677,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
var cmap = lookupCmap(this.cmap, unicode); var cmap = lookupCmap(this.cmap, unicode);
var fn = this.compiledGlyphs[cmap.glyphId]; var fn = this.compiledGlyphs[cmap.glyphId];
if (!fn) { if (!fn) {
fn = this.compileGlyph(this.glyphs[cmap.glyphId]); fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
this.compiledGlyphs[cmap.glyphId] = fn; this.compiledGlyphs[cmap.glyphId] = fn;
} }
if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) { if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
@ -663,21 +685,31 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
} }
return fn; return fn;
}, },
compileGlyph: function compileGlyph(code) { compileGlyph: function compileGlyph(code, glyphId) {
if (!code || code.length === 0 || code[0] === 14) { if (!code || code.length === 0 || code[0] === 14) {
return noop; return noop;
} }
var fontMatrix = this.fontMatrix;
if (this.isCFFCIDFont) {
var fdIndex = this.fdSelect.getFDIndex(glyphId);
if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
var fontDict = this.fdArray[fdIndex];
fontMatrix = fontDict.getByName('FontMatrix') || _util.FONT_IDENTITY_MATRIX;
} else {
(0, _util.warn)('Invalid fd index for glyph index.');
}
}
var cmds = []; var cmds = [];
cmds.push({ cmd: 'save' }); cmds.push({ cmd: 'save' });
cmds.push({ cmds.push({
cmd: 'transform', cmd: 'transform',
args: this.fontMatrix.slice() args: fontMatrix.slice()
}); });
cmds.push({ cmds.push({
cmd: 'scale', cmd: 'scale',
args: ['size', '-size'] args: ['size', '-size']
}); });
this.compileGlyphImpl(code, cmds); this.compileGlyphImpl(code, cmds, glyphId);
cmds.push({ cmd: 'restore' }); cmds.push({ cmd: 'restore' });
return cmds; return cmds;
}, },
@ -710,10 +742,13 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)(); this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768; this.gsubrsBias = this.gsubrs.length < 1240 ? 107 : this.gsubrs.length < 33900 ? 1131 : 32768;
this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768; this.subrsBias = this.subrs.length < 1240 ? 107 : this.subrs.length < 33900 ? 1131 : 32768;
this.isCFFCIDFont = cffInfo.isCFFCIDFont;
this.fdSelect = cffInfo.fdSelect;
this.fdArray = cffInfo.fdArray;
} }
_util.Util.inherit(Type2Compiled, CompiledFont, { _util.Util.inherit(Type2Compiled, CompiledFont, {
compileGlyphImpl: function compileGlyphImpl(code, cmds) { compileGlyphImpl: function compileGlyphImpl(code, cmds, glyphId) {
compileCharString(code, cmds, this); compileCharString(code, cmds, this, glyphId);
} }
}); });
return { return {

2
lib/core/worker.js

@ -223,7 +223,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null; var cancelXHRs = null;
var WorkerTasks = []; var WorkerTasks = [];
var apiVersion = docParams.apiVersion; var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.487'; var workerVersion = '2.0.489';
if (apiVersion !== null && apiVersion !== workerVersion) { if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".')); throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
} }

6
lib/display/api.js

@ -232,7 +232,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
} }
return worker.messageHandler.sendWithPromise('GetDocRequest', { return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId: docId, docId: docId,
apiVersion: '2.0.487', apiVersion: '2.0.489',
source: { source: {
data: source.data, data: source.data,
url: source.url, url: source.url,
@ -1650,8 +1650,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}(); }();
var version, build; var version, build;
{ {
exports.version = version = '2.0.487'; exports.version = version = '2.0.489';
exports.build = build = '2275485c'; exports.build = build = '7d7bc80e';
} }
exports.getDocument = getDocument; exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort; exports.LoopbackPort = LoopbackPort;

4
lib/pdf.js

@ -21,8 +21,8 @@
*/ */
'use strict'; 'use strict';
var pdfjsVersion = '2.0.487'; var pdfjsVersion = '2.0.489';
var pdfjsBuild = '2275485c'; var pdfjsBuild = '7d7bc80e';
var pdfjsSharedUtil = require('./shared/util.js'); var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayAPI = require('./display/api.js'); var pdfjsDisplayAPI = require('./display/api.js');
var pdfjsDisplayTextLayer = require('./display/text_layer.js'); var pdfjsDisplayTextLayer = require('./display/text_layer.js');

4
lib/pdf.worker.js vendored

@ -21,7 +21,7 @@
*/ */
'use strict'; 'use strict';
var pdfjsVersion = '2.0.487'; var pdfjsVersion = '2.0.489';
var pdfjsBuild = '2275485c'; var pdfjsBuild = '7d7bc80e';
var pdfjsCoreWorker = require('./core/worker.js'); var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

4
lib/web/pdf_viewer.component.js

@ -48,8 +48,8 @@ var _pdf_single_page_viewer = require('./pdf_single_page_viewer');
var _pdf_viewer = require('./pdf_viewer.js'); var _pdf_viewer = require('./pdf_viewer.js');
var pdfjsVersion = '2.0.487'; var pdfjsVersion = '2.0.489';
var pdfjsBuild = '2275485c'; var pdfjsBuild = '7d7bc80e';
exports.PDFViewer = _pdf_viewer.PDFViewer; exports.PDFViewer = _pdf_viewer.PDFViewer;
exports.PDFSinglePageViewer = _pdf_single_page_viewer.PDFSinglePageViewer; exports.PDFSinglePageViewer = _pdf_single_page_viewer.PDFSinglePageViewer;
exports.PDFPageView = _pdf_page_view.PDFPageView; exports.PDFPageView = _pdf_page_view.PDFPageView;

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "2.0.487", "version": "2.0.489",
"main": "build/pdf.js", "main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.", "description": "Generic build of Mozilla's PDF.js library.",
"keywords": [ "keywords": [

4
web/pdf_viewer.js

@ -3204,8 +3204,8 @@ var _pdf_single_page_viewer = __w_pdfjs_require__(16);
var _pdf_viewer = __w_pdfjs_require__(17); var _pdf_viewer = __w_pdfjs_require__(17);
var pdfjsVersion = '2.0.487'; var pdfjsVersion = '2.0.489';
var pdfjsBuild = '2275485c'; var pdfjsBuild = '7d7bc80e';
exports.PDFViewer = _pdf_viewer.PDFViewer; exports.PDFViewer = _pdf_viewer.PDFViewer;
exports.PDFSinglePageViewer = _pdf_single_page_viewer.PDFSinglePageViewer; exports.PDFSinglePageViewer = _pdf_single_page_viewer.PDFSinglePageViewer;
exports.PDFPageView = _pdf_page_view.PDFPageView; exports.PDFPageView = _pdf_page_view.PDFPageView;

2
web/pdf_viewer.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save