Skip to content
This repository has been archived by the owner on Jul 14, 2024. It is now read-only.

Commit

Permalink
PDF.js version 2.0.489 - See mozilla/pdf.js@7d7bc80
Browse files Browse the repository at this point in the history
  • Loading branch information
pdfjsbot committed Apr 11, 2018
1 parent 0231e15 commit 75d0c0c
Show file tree
Hide file tree
Showing 16 changed files with 123 additions and 53 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "2.0.487",
"version": "2.0.489",
"main": [
"build/pdf.js",
"build/pdf.worker.js"
Expand Down
12 changes: 6 additions & 6 deletions build/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ if (typeof __g == 'number') __g = global;
"use strict";


var core = module.exports = { version: '2.5.4' };
var core = module.exports = { version: '2.5.5' };
if (typeof __e == 'number') __e = core;

/***/ }),
Expand Down Expand Up @@ -3003,8 +3003,8 @@ exports.GlobalWorkerOptions = GlobalWorkerOptions;
"use strict";


var pdfjsVersion = '2.0.487';
var pdfjsBuild = '2275485c';
var pdfjsVersion = '2.0.489';
var pdfjsBuild = '7d7bc80e';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayAPI = __w_pdfjs_require__(117);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(125);
Expand Down Expand Up @@ -8437,7 +8437,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
}
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId: docId,
apiVersion: '2.0.487',
apiVersion: '2.0.489',
source: {
data: source.data,
url: source.url,
Expand Down Expand Up @@ -9855,8 +9855,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.487';
exports.build = build = '2275485c';
exports.version = version = '2.0.489';
exports.build = build = '7d7bc80e';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
Expand Down
2 changes: 1 addition & 1 deletion build/pdf.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/pdf.min.js

Large diffs are not rendered by default.

67 changes: 51 additions & 16 deletions build/pdf.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2759,7 +2759,7 @@ if (typeof __g == 'number') __g = global;
"use strict";


var core = module.exports = { version: '2.5.4' };
var core = module.exports = { version: '2.5.5' };
if (typeof __e == 'number') __e = core;

/***/ }),
Expand Down Expand Up @@ -22360,8 +22360,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict";


var pdfjsVersion = '2.0.487';
var pdfjsBuild = '2275485c';
var pdfjsVersion = '2.0.489';
var pdfjsBuild = '7d7bc80e';
var pdfjsCoreWorker = __w_pdfjs_require__(74);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

Expand Down Expand Up @@ -22574,7 +22574,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.487';
var workerVersion = '2.0.489';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}
Expand Down Expand Up @@ -38934,7 +38934,10 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
return {
glyphs: cff.charStrings.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) {
Expand Down Expand Up @@ -39138,7 +39141,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
}
}
}
function compileCharString(code, cmds, font) {
function compileCharString(code, cmds, font, glyphId) {
var stack = [];
var x = 0,
y = 0;
Expand Down Expand Up @@ -39222,8 +39225,27 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
}
break;
case 10:
n = stack.pop() + font.subrsBias;
subrCode = font.subrs[n];
n = stack.pop();
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) {
parse(subrCode);
}
Expand Down Expand Up @@ -39313,10 +39335,10 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
args: [x, y]
});
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' });
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;
case 18:
Expand Down Expand Up @@ -39491,29 +39513,39 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
var cmap = lookupCmap(this.cmap, unicode);
var fn = this.compiledGlyphs[cmap.glyphId];
if (!fn) {
fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
this.compiledGlyphs[cmap.glyphId] = fn;
}
if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
}
return fn;
},
compileGlyph: function compileGlyph(code) {
compileGlyph: function compileGlyph(code, glyphId) {
if (!code || code.length === 0 || code[0] === 14) {
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 = [];
cmds.push({ cmd: 'save' });
cmds.push({
cmd: 'transform',
args: this.fontMatrix.slice()
args: fontMatrix.slice()
});
cmds.push({
cmd: 'scale',
args: ['size', '-size']
});
this.compileGlyphImpl(code, cmds);
this.compileGlyphImpl(code, cmds, glyphId);
cmds.push({ cmd: 'restore' });
return cmds;
},
Expand Down Expand Up @@ -39546,10 +39578,13 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
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.isCFFCIDFont = cffInfo.isCFFCIDFont;
this.fdSelect = cffInfo.fdSelect;
this.fdArray = cffInfo.fdArray;
}
_util.Util.inherit(Type2Compiled, CompiledFont, {
compileGlyphImpl: function compileGlyphImpl(code, cmds) {
compileCharString(code, cmds, this);
compileGlyphImpl: function compileGlyphImpl(code, cmds, glyphId) {
compileCharString(code, cmds, this, glyphId);
}
});
return {
Expand Down
2 changes: 1 addition & 1 deletion build/pdf.worker.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/pdf.worker.min.js

Large diffs are not rendered by default.

59 changes: 47 additions & 12 deletions lib/core/font_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
return {
glyphs: cff.charStrings.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) {
Expand Down Expand Up @@ -302,7 +305,7 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
}
}
}
function compileCharString(code, cmds, font) {
function compileCharString(code, cmds, font, glyphId) {
var stack = [];
var x = 0,
y = 0;
Expand Down Expand Up @@ -386,8 +389,27 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
}
break;
case 10:
n = stack.pop() + font.subrsBias;
subrCode = font.subrs[n];
n = stack.pop();
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) {
parse(subrCode);
}
Expand Down Expand Up @@ -477,10 +499,10 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
args: [x, y]
});
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' });
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;
case 18:
Expand Down Expand Up @@ -655,29 +677,39 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
var cmap = lookupCmap(this.cmap, unicode);
var fn = this.compiledGlyphs[cmap.glyphId];
if (!fn) {
fn = this.compileGlyph(this.glyphs[cmap.glyphId]);
fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
this.compiledGlyphs[cmap.glyphId] = fn;
}
if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
}
return fn;
},
compileGlyph: function compileGlyph(code) {
compileGlyph: function compileGlyph(code, glyphId) {
if (!code || code.length === 0 || code[0] === 14) {
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 = [];
cmds.push({ cmd: 'save' });
cmds.push({
cmd: 'transform',
args: this.fontMatrix.slice()
args: fontMatrix.slice()
});
cmds.push({
cmd: 'scale',
args: ['size', '-size']
});
this.compileGlyphImpl(code, cmds);
this.compileGlyphImpl(code, cmds, glyphId);
cmds.push({ cmd: 'restore' });
return cmds;
},
Expand Down Expand Up @@ -710,10 +742,13 @@ var FontRendererFactory = function FontRendererFactoryClosure() {
this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
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.isCFFCIDFont = cffInfo.isCFFCIDFont;
this.fdSelect = cffInfo.fdSelect;
this.fdArray = cffInfo.fdArray;
}
_util.Util.inherit(Type2Compiled, CompiledFont, {
compileGlyphImpl: function compileGlyphImpl(code, cmds) {
compileCharString(code, cmds, this);
compileGlyphImpl: function compileGlyphImpl(code, cmds, glyphId) {
compileCharString(code, cmds, this, glyphId);
}
});
return {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.487';
var workerVersion = '2.0.489';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}
Expand Down
6 changes: 3 additions & 3 deletions lib/display/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
}
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId: docId,
apiVersion: '2.0.487',
apiVersion: '2.0.489',
source: {
data: source.data,
url: source.url,
Expand Down Expand Up @@ -1650,8 +1650,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.487';
exports.build = build = '2275485c';
exports.version = version = '2.0.489';
exports.build = build = '7d7bc80e';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
Expand Down
4 changes: 2 additions & 2 deletions lib/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
*/
'use strict';

var pdfjsVersion = '2.0.487';
var pdfjsBuild = '2275485c';
var pdfjsVersion = '2.0.489';
var pdfjsBuild = '7d7bc80e';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayAPI = require('./display/api.js');
var pdfjsDisplayTextLayer = require('./display/text_layer.js');
Expand Down
4 changes: 2 additions & 2 deletions lib/pdf.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
'use strict';

var pdfjsVersion = '2.0.487';
var pdfjsBuild = '2275485c';
var pdfjsVersion = '2.0.489';
var pdfjsBuild = '7d7bc80e';
var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
4 changes: 2 additions & 2 deletions lib/web/pdf_viewer.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ var _pdf_single_page_viewer = require('./pdf_single_page_viewer');

var _pdf_viewer = require('./pdf_viewer.js');

var pdfjsVersion = '2.0.487';
var pdfjsBuild = '2275485c';
var pdfjsVersion = '2.0.489';
var pdfjsBuild = '7d7bc80e';
exports.PDFViewer = _pdf_viewer.PDFViewer;
exports.PDFSinglePageViewer = _pdf_single_page_viewer.PDFSinglePageViewer;
exports.PDFPageView = _pdf_page_view.PDFPageView;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "2.0.487",
"version": "2.0.489",
"main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.",
"keywords": [
Expand Down
Loading

0 comments on commit 75d0c0c

Please sign in to comment.