Browse Source

PDF.js version 1.3.150 - See mozilla/pdf.js@62ade3e3732b741ddfb0170eaadf4d45c40d1973

master v1.3.150
Pdf Bot 9 years ago
parent
commit
cc0d939805
  1. 2
      bower.json
  2. 176
      build/pdf.combined.js
  3. 4
      build/pdf.js
  4. 176
      build/pdf.worker.js
  5. 2
      package.json

2
bower.json

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

176
build/pdf.combined.js

@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') { @@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
typeof global !== 'undefined' ? global : this).PDFJS = {};
}
PDFJS.version = '1.3.148';
PDFJS.build = '4e9ea35';
PDFJS.version = '1.3.150';
PDFJS.build = '62ade3e';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it
@ -32414,6 +32414,9 @@ var HINTING_ENABLED = false; @@ -32414,6 +32414,9 @@ var HINTING_ENABLED = false;
// to control analysis of seac charstrings.
var SEAC_ANALYSIS_ENABLED = false;
// Maximum subroutine call depth of type 2 chartrings. Matches OTS.
var MAX_SUBR_NESTING = 10;
var FontFlags = {
FixedPitch: 1,
Serif: 2,
@ -38443,10 +38446,7 @@ var CFFParser = (function CFFParserClosure() { @@ -38443,10 +38446,7 @@ var CFFParser = (function CFFParserClosure() {
cff.isCIDFont = topDict.hasName('ROS');
var charStringOffset = topDict.getByName('CharStrings');
var charStringsAndSeacs = this.parseCharStrings(charStringOffset);
cff.charStrings = charStringsAndSeacs.charStrings;
cff.seacs = charStringsAndSeacs.seacs;
cff.widths = charStringsAndSeacs.widths;
var charStringIndex = this.parseIndex(charStringOffset).obj;
var fontMatrix = topDict.getByName('FontMatrix');
if (fontMatrix) {
@ -38474,19 +38474,30 @@ var CFFParser = (function CFFParserClosure() { @@ -38474,19 +38474,30 @@ var CFFParser = (function CFFParserClosure() {
// cid fonts don't have an encoding
encoding = null;
charset = this.parseCharsets(topDict.getByName('charset'),
cff.charStrings.count, cff.strings, true);
charStringIndex.count, cff.strings, true);
cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'),
cff.charStrings.count);
charStringIndex.count);
} else {
charset = this.parseCharsets(topDict.getByName('charset'),
cff.charStrings.count, cff.strings, false);
charStringIndex.count, cff.strings, false);
encoding = this.parseEncoding(topDict.getByName('Encoding'),
properties,
cff.strings, charset.charset);
}
cff.charset = charset;
cff.encoding = encoding;
var charStringsAndSeacs = this.parseCharStrings(
charStringIndex,
topDict.privateDict.subrsIndex,
globalSubrIndex.obj,
cff.fdSelect,
cff.fdArray);
cff.charStrings = charStringsAndSeacs.charStrings;
cff.seacs = charStringsAndSeacs.seacs;
cff.widths = charStringsAndSeacs.widths;
return cff;
},
parseHeader: function CFFParser_parseHeader() {
@ -38661,22 +38672,17 @@ var CFFParser = (function CFFParserClosure() { @@ -38661,22 +38672,17 @@ var CFFParser = (function CFFParserClosure() {
}
return cffDict;
},
parseCharStrings: function CFFParser_parseCharStrings(charStringOffset) {
var charStrings = this.parseIndex(charStringOffset).obj;
var seacs = [];
var widths = [];
var count = charStrings.count;
for (var i = 0; i < count; i++) {
var charstring = charStrings.get(i);
parseCharString: function CFFParser_parseCharString(state, data,
localSubrIndex,
globalSubrIndex) {
if (state.callDepth > MAX_SUBR_NESTING) {
return false;
}
var stackSize = state.stackSize;
var stack = state.stack;
var stackSize = 0;
var stack = [];
var undefStack = true;
var hints = 0;
var valid = true;
var data = charstring;
var length = data.length;
var firstStackClearing = true;
for (var j = 0; j < length;) {
var value = data[j++];
var validationCommand = null;
@ -38702,8 +38708,8 @@ var CFFParser = (function CFFParserClosure() { @@ -38702,8 +38708,8 @@ var CFFParser = (function CFFParserClosure() {
if (stackSize >= 4) {
stackSize -= 4;
if (SEAC_ANALYSIS_ENABLED) {
seacs[i] = stack.slice(stackSize, stackSize + 4);
valid = false;
state.seac = stack.slice(stackSize, stackSize + 4);
return false;
}
}
validationCommand = CharstringValidationData[value];
@ -38722,28 +38728,65 @@ var CFFParser = (function CFFParserClosure() { @@ -38722,28 +38728,65 @@ var CFFParser = (function CFFParserClosure() {
j += 4;
stackSize++;
} else if (value === 19 || value === 20) {
hints += stackSize >> 1;
j += (hints + 7) >> 3; // skipping right amount of hints flag data
state.hints += stackSize >> 1;
// skipping right amount of hints flag data
j += (state.hints + 7) >> 3;
stackSize %= 2;
validationCommand = CharstringValidationData[value];
} else if (value === 10 || value === 29) {
var subrsIndex;
if (value === 10) {
subrsIndex = localSubrIndex;
} else {
subrsIndex = globalSubrIndex;
}
if (!subrsIndex) {
validationCommand = CharstringValidationData[value];
warn('Missing subrsIndex for ' + validationCommand.id);
return false;
}
var bias = 32768;
if (subrsIndex.count < 1240) {
bias = 107;
} else if (subrsIndex.count < 33900) {
bias = 1131;
}
var subrNumber = stack[--stackSize] + bias;
if (subrNumber < 0 || subrNumber >= subrsIndex.count) {
validationCommand = CharstringValidationData[value];
warn('Out of bounds subrIndex for ' + validationCommand.id);
return false;
}
state.stackSize = stackSize;
state.callDepth++;
var valid = this.parseCharString(state, subrsIndex.get(subrNumber),
localSubrIndex, globalSubrIndex);
if (!valid) {
return false;
}
state.callDepth--;
stackSize = state.stackSize;
continue;
} else if (value === 11) {
state.stackSize = stackSize;
return true;
} else {
validationCommand = CharstringValidationData[value];
}
if (validationCommand) {
if (validationCommand.stem) {
hints += stackSize >> 1;
state.hints += stackSize >> 1;
}
if ('min' in validationCommand) {
if (!undefStack && stackSize < validationCommand.min) {
if (!state.undefStack && stackSize < validationCommand.min) {
warn('Not enough parameters for ' + validationCommand.id +
'; actual: ' + stackSize +
', expected: ' + validationCommand.min);
valid = false;
break;
return false;
}
}
if (firstStackClearing && validationCommand.stackClearing) {
firstStackClearing = false;
if (state.firstStackClearing && validationCommand.stackClearing) {
state.firstStackClearing = false;
// the optional character width can be found before the first
// stack-clearing command arguments
stackSize -= validationCommand.min;
@ -38754,7 +38797,7 @@ var CFFParser = (function CFFParserClosure() { @@ -38754,7 +38797,7 @@ var CFFParser = (function CFFParserClosure() {
warn('Found too many parameters for stack-clearing command');
}
if (stackSize > 0 && stack[stackSize - 1] >= 0) {
widths[i] = stack[stackSize - 1];
state.width = stack[stackSize - 1];
}
}
if ('stackDelta' in validationCommand) {
@ -38766,14 +38809,65 @@ var CFFParser = (function CFFParserClosure() { @@ -38766,14 +38809,65 @@ var CFFParser = (function CFFParserClosure() {
stackSize = 0;
} else if (validationCommand.resetStack) {
stackSize = 0;
undefStack = false;
state.undefStack = false;
} else if (validationCommand.undefStack) {
stackSize = 0;
undefStack = true;
firstStackClearing = false;
state.undefStack = true;
state.firstStackClearing = false;
}
}
}
state.stackSize = stackSize;
return true;
},
parseCharStrings: function CFFParser_parseCharStrings(charStrings,
localSubrIndex,
globalSubrIndex,
fdSelect,
fdArray) {
var seacs = [];
var widths = [];
var count = charStrings.count;
for (var i = 0; i < count; i++) {
var charstring = charStrings.get(i);
var state = {
callDepth: 0,
stackSize: 0,
stack: [],
undefStack: true,
hints: 0,
firstStackClearing: true,
seac: null,
width: null
};
var valid = true;
var localSubrToUse = null;
if (fdSelect && fdArray.length) {
var fdIndex = fdSelect.getFDIndex(i);
if (fdIndex === -1) {
warn('Glyph index is not in fd select.');
valid = false;
}
if (fdIndex >= fdArray.length) {
warn('Invalid fd index for glyph index.');
valid = false;
}
if (valid) {
localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex;
}
} else if (localSubrIndex) {
localSubrToUse = localSubrIndex;
}
if (valid) {
valid = this.parseCharString(state, charstring, localSubrToUse,
globalSubrIndex);
}
if (state.width !== null) {
widths[i] = state.width;
}
if (state.seac !== null) {
seacs[i] = state.seac;
}
if (!valid) {
// resetting invalid charstring to single 'endchar'
charStrings.set(i, new Uint8Array([14]));
@ -39267,6 +39361,14 @@ var CFFFDSelect = (function CFFFDSelectClosure() { @@ -39267,6 +39361,14 @@ var CFFFDSelect = (function CFFFDSelectClosure() {
this.fdSelect = fdSelect;
this.raw = raw;
}
CFFFDSelect.prototype = {
getFDIndex: function CFFFDSelect_get(glyphIndex) {
if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
return -1;
}
return this.fdSelect[glyphIndex];
}
};
return CFFFDSelect;
})();

4
build/pdf.js

@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') { @@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
typeof global !== 'undefined' ? global : this).PDFJS = {};
}
PDFJS.version = '1.3.148';
PDFJS.build = '4e9ea35';
PDFJS.version = '1.3.150';
PDFJS.build = '62ade3e';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it

176
build/pdf.worker.js vendored

@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') { @@ -21,8 +21,8 @@ if (typeof PDFJS === 'undefined') {
typeof global !== 'undefined' ? global : this).PDFJS = {};
}
PDFJS.version = '1.3.148';
PDFJS.build = '4e9ea35';
PDFJS.version = '1.3.150';
PDFJS.build = '62ade3e';
(function pdfjsWrapper() {
// Use strict in our context only - users might not want it
@ -24602,6 +24602,9 @@ var HINTING_ENABLED = false; @@ -24602,6 +24602,9 @@ var HINTING_ENABLED = false;
// to control analysis of seac charstrings.
var SEAC_ANALYSIS_ENABLED = false;
// Maximum subroutine call depth of type 2 chartrings. Matches OTS.
var MAX_SUBR_NESTING = 10;
var FontFlags = {
FixedPitch: 1,
Serif: 2,
@ -30631,10 +30634,7 @@ var CFFParser = (function CFFParserClosure() { @@ -30631,10 +30634,7 @@ var CFFParser = (function CFFParserClosure() {
cff.isCIDFont = topDict.hasName('ROS');
var charStringOffset = topDict.getByName('CharStrings');
var charStringsAndSeacs = this.parseCharStrings(charStringOffset);
cff.charStrings = charStringsAndSeacs.charStrings;
cff.seacs = charStringsAndSeacs.seacs;
cff.widths = charStringsAndSeacs.widths;
var charStringIndex = this.parseIndex(charStringOffset).obj;
var fontMatrix = topDict.getByName('FontMatrix');
if (fontMatrix) {
@ -30662,19 +30662,30 @@ var CFFParser = (function CFFParserClosure() { @@ -30662,19 +30662,30 @@ var CFFParser = (function CFFParserClosure() {
// cid fonts don't have an encoding
encoding = null;
charset = this.parseCharsets(topDict.getByName('charset'),
cff.charStrings.count, cff.strings, true);
charStringIndex.count, cff.strings, true);
cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'),
cff.charStrings.count);
charStringIndex.count);
} else {
charset = this.parseCharsets(topDict.getByName('charset'),
cff.charStrings.count, cff.strings, false);
charStringIndex.count, cff.strings, false);
encoding = this.parseEncoding(topDict.getByName('Encoding'),
properties,
cff.strings, charset.charset);
}
cff.charset = charset;
cff.encoding = encoding;
var charStringsAndSeacs = this.parseCharStrings(
charStringIndex,
topDict.privateDict.subrsIndex,
globalSubrIndex.obj,
cff.fdSelect,
cff.fdArray);
cff.charStrings = charStringsAndSeacs.charStrings;
cff.seacs = charStringsAndSeacs.seacs;
cff.widths = charStringsAndSeacs.widths;
return cff;
},
parseHeader: function CFFParser_parseHeader() {
@ -30849,22 +30860,17 @@ var CFFParser = (function CFFParserClosure() { @@ -30849,22 +30860,17 @@ var CFFParser = (function CFFParserClosure() {
}
return cffDict;
},
parseCharStrings: function CFFParser_parseCharStrings(charStringOffset) {
var charStrings = this.parseIndex(charStringOffset).obj;
var seacs = [];
var widths = [];
var count = charStrings.count;
for (var i = 0; i < count; i++) {
var charstring = charStrings.get(i);
parseCharString: function CFFParser_parseCharString(state, data,
localSubrIndex,
globalSubrIndex) {
if (state.callDepth > MAX_SUBR_NESTING) {
return false;
}
var stackSize = state.stackSize;
var stack = state.stack;
var stackSize = 0;
var stack = [];
var undefStack = true;
var hints = 0;
var valid = true;
var data = charstring;
var length = data.length;
var firstStackClearing = true;
for (var j = 0; j < length;) {
var value = data[j++];
var validationCommand = null;
@ -30890,8 +30896,8 @@ var CFFParser = (function CFFParserClosure() { @@ -30890,8 +30896,8 @@ var CFFParser = (function CFFParserClosure() {
if (stackSize >= 4) {
stackSize -= 4;
if (SEAC_ANALYSIS_ENABLED) {
seacs[i] = stack.slice(stackSize, stackSize + 4);
valid = false;
state.seac = stack.slice(stackSize, stackSize + 4);
return false;
}
}
validationCommand = CharstringValidationData[value];
@ -30910,28 +30916,65 @@ var CFFParser = (function CFFParserClosure() { @@ -30910,28 +30916,65 @@ var CFFParser = (function CFFParserClosure() {
j += 4;
stackSize++;
} else if (value === 19 || value === 20) {
hints += stackSize >> 1;
j += (hints + 7) >> 3; // skipping right amount of hints flag data
state.hints += stackSize >> 1;
// skipping right amount of hints flag data
j += (state.hints + 7) >> 3;
stackSize %= 2;
validationCommand = CharstringValidationData[value];
} else if (value === 10 || value === 29) {
var subrsIndex;
if (value === 10) {
subrsIndex = localSubrIndex;
} else {
subrsIndex = globalSubrIndex;
}
if (!subrsIndex) {
validationCommand = CharstringValidationData[value];
warn('Missing subrsIndex for ' + validationCommand.id);
return false;
}
var bias = 32768;
if (subrsIndex.count < 1240) {
bias = 107;
} else if (subrsIndex.count < 33900) {
bias = 1131;
}
var subrNumber = stack[--stackSize] + bias;
if (subrNumber < 0 || subrNumber >= subrsIndex.count) {
validationCommand = CharstringValidationData[value];
warn('Out of bounds subrIndex for ' + validationCommand.id);
return false;
}
state.stackSize = stackSize;
state.callDepth++;
var valid = this.parseCharString(state, subrsIndex.get(subrNumber),
localSubrIndex, globalSubrIndex);
if (!valid) {
return false;
}
state.callDepth--;
stackSize = state.stackSize;
continue;
} else if (value === 11) {
state.stackSize = stackSize;
return true;
} else {
validationCommand = CharstringValidationData[value];
}
if (validationCommand) {
if (validationCommand.stem) {
hints += stackSize >> 1;
state.hints += stackSize >> 1;
}
if ('min' in validationCommand) {
if (!undefStack && stackSize < validationCommand.min) {
if (!state.undefStack && stackSize < validationCommand.min) {
warn('Not enough parameters for ' + validationCommand.id +
'; actual: ' + stackSize +
', expected: ' + validationCommand.min);
valid = false;
break;
return false;
}
}
if (firstStackClearing && validationCommand.stackClearing) {
firstStackClearing = false;
if (state.firstStackClearing && validationCommand.stackClearing) {
state.firstStackClearing = false;
// the optional character width can be found before the first
// stack-clearing command arguments
stackSize -= validationCommand.min;
@ -30942,7 +30985,7 @@ var CFFParser = (function CFFParserClosure() { @@ -30942,7 +30985,7 @@ var CFFParser = (function CFFParserClosure() {
warn('Found too many parameters for stack-clearing command');
}
if (stackSize > 0 && stack[stackSize - 1] >= 0) {
widths[i] = stack[stackSize - 1];
state.width = stack[stackSize - 1];
}
}
if ('stackDelta' in validationCommand) {
@ -30954,14 +30997,65 @@ var CFFParser = (function CFFParserClosure() { @@ -30954,14 +30997,65 @@ var CFFParser = (function CFFParserClosure() {
stackSize = 0;
} else if (validationCommand.resetStack) {
stackSize = 0;
undefStack = false;
state.undefStack = false;
} else if (validationCommand.undefStack) {
stackSize = 0;
undefStack = true;
firstStackClearing = false;
state.undefStack = true;
state.firstStackClearing = false;
}
}
}
state.stackSize = stackSize;
return true;
},
parseCharStrings: function CFFParser_parseCharStrings(charStrings,
localSubrIndex,
globalSubrIndex,
fdSelect,
fdArray) {
var seacs = [];
var widths = [];
var count = charStrings.count;
for (var i = 0; i < count; i++) {
var charstring = charStrings.get(i);
var state = {
callDepth: 0,
stackSize: 0,
stack: [],
undefStack: true,
hints: 0,
firstStackClearing: true,
seac: null,
width: null
};
var valid = true;
var localSubrToUse = null;
if (fdSelect && fdArray.length) {
var fdIndex = fdSelect.getFDIndex(i);
if (fdIndex === -1) {
warn('Glyph index is not in fd select.');
valid = false;
}
if (fdIndex >= fdArray.length) {
warn('Invalid fd index for glyph index.');
valid = false;
}
if (valid) {
localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex;
}
} else if (localSubrIndex) {
localSubrToUse = localSubrIndex;
}
if (valid) {
valid = this.parseCharString(state, charstring, localSubrToUse,
globalSubrIndex);
}
if (state.width !== null) {
widths[i] = state.width;
}
if (state.seac !== null) {
seacs[i] = state.seac;
}
if (!valid) {
// resetting invalid charstring to single 'endchar'
charStrings.set(i, new Uint8Array([14]));
@ -31455,6 +31549,14 @@ var CFFFDSelect = (function CFFFDSelectClosure() { @@ -31455,6 +31549,14 @@ var CFFFDSelect = (function CFFFDSelectClosure() {
this.fdSelect = fdSelect;
this.raw = raw;
}
CFFFDSelect.prototype = {
getFDIndex: function CFFFDSelect_get(glyphIndex) {
if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
return -1;
}
return this.fdSelect[glyphIndex];
}
};
return CFFFDSelect;
})();

2
package.json

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

Loading…
Cancel
Save