Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
fe0c4c3bf7
49
src/fonts.js
49
src/fonts.js
@ -3293,6 +3293,14 @@ var Font = (function FontClosure() {
|
|||||||
return Font;
|
return Font;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
var CallothersubrCmd = (function CallothersubrCmdClosure() {
|
||||||
|
function CallothersubrCmd(index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CallothersubrCmd;
|
||||||
|
})();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Type1Parser encapsulate the needed code for parsing a Type1 font
|
* Type1Parser encapsulate the needed code for parsing a Type1 font
|
||||||
* program. Some of its logic depends on the Type2 charstrings
|
* program. Some of its logic depends on the Type2 charstrings
|
||||||
@ -3498,6 +3506,10 @@ var Type1Parser = function type1Parser() {
|
|||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(argc == 0, 'callothersubr with arguments is not supported');
|
||||||
|
charstring.push(new CallothersubrCmd(index));
|
||||||
|
continue;
|
||||||
} else if (escape == 17 || escape == 33) {
|
} else if (escape == 17 || escape == 33) {
|
||||||
// pop or setcurrentpoint commands can be ignored
|
// pop or setcurrentpoint commands can be ignored
|
||||||
// since we are not doing callothersubr
|
// since we are not doing callothersubr
|
||||||
@ -4017,14 +4029,14 @@ Type1Font.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getType2Charstrings: function Type1Font_getType2Charstrings(
|
getType2Charstrings: function Type1Font_getType2Charstrings(
|
||||||
type1Charstrings) {
|
type1Subrs) {
|
||||||
var type2Charstrings = [];
|
var type2Charstrings = [];
|
||||||
var count = type1Charstrings.length;
|
var count = type1Subrs.length;
|
||||||
for (var i = 0; i < count; i++) {
|
var type1Charstrings = [];
|
||||||
var charstring = type1Charstrings[i].charstring;
|
for (var i = 0; i < count; i++)
|
||||||
type2Charstrings.push(this.flattenCharstring(charstring.slice(),
|
type1Charstrings.push(type1Subrs[i].charstring.slice());
|
||||||
this.commandsMap));
|
for (var i = 0; i < count; i++)
|
||||||
}
|
type2Charstrings.push(this.flattenCharstring(type1Charstrings, i));
|
||||||
return type2Charstrings;
|
return type2Charstrings;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -4044,11 +4056,7 @@ Type1Font.prototype = {
|
|||||||
type2Subrs.push([0x0B]);
|
type2Subrs.push([0x0B]);
|
||||||
|
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
var subr = type1Subrs[i];
|
type2Subrs.push(this.flattenCharstring(type1Subrs, i));
|
||||||
if (!subr)
|
|
||||||
subr = [0x0B];
|
|
||||||
|
|
||||||
type2Subrs.push(this.flattenCharstring(subr, this.commandsMap));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return type2Subrs;
|
return type2Subrs;
|
||||||
@ -4080,7 +4088,11 @@ Type1Font.prototype = {
|
|||||||
'hvcurveto': 31
|
'hvcurveto': 31
|
||||||
},
|
},
|
||||||
|
|
||||||
flattenCharstring: function Type1Font_flattenCharstring(charstring, map) {
|
flattenCharstring: function Type1Font_flattenCharstring(charstrings, index) {
|
||||||
|
var charstring = charstrings[index];
|
||||||
|
if (!charstring)
|
||||||
|
return [0x0B];
|
||||||
|
var map = this.commandsMap;
|
||||||
// charstring changes size - can't cache .length in loop
|
// charstring changes size - can't cache .length in loop
|
||||||
for (var i = 0; i < charstring.length; i++) {
|
for (var i = 0; i < charstring.length; i++) {
|
||||||
var command = charstring[i];
|
var command = charstring[i];
|
||||||
@ -4092,6 +4104,17 @@ Type1Font.prototype = {
|
|||||||
charstring.splice(i++, 1, cmd[0], cmd[1]);
|
charstring.splice(i++, 1, cmd[0], cmd[1]);
|
||||||
else
|
else
|
||||||
charstring[i] = cmd;
|
charstring[i] = cmd;
|
||||||
|
} else if (command instanceof CallothersubrCmd) {
|
||||||
|
var otherSubrCharstring = charstrings[command.index];
|
||||||
|
if (otherSubrCharstring) {
|
||||||
|
var lastCommand = otherSubrCharstring.indexOf('return');
|
||||||
|
if (lastCommand >= 0)
|
||||||
|
otherSubrCharstring = otherSubrCharstring.slice(0, lastCommand);
|
||||||
|
charstring.splice.apply(charstring,
|
||||||
|
[i, 1].concat(otherSubrCharstring));
|
||||||
|
} else
|
||||||
|
charstring.splice(i, 1); // ignoring empty subr call
|
||||||
|
i--;
|
||||||
} else {
|
} else {
|
||||||
// Type1 charstring use a division for number above 32000
|
// Type1 charstring use a division for number above 32000
|
||||||
if (command > 32000) {
|
if (command > 32000) {
|
||||||
|
@ -624,7 +624,7 @@ var XRef = (function XRefClosure() {
|
|||||||
var e = this.entries[i];
|
var e = this.entries[i];
|
||||||
if (e === null)
|
if (e === null)
|
||||||
return null;
|
return null;
|
||||||
return e.free ? null : e; // returns null is the entry is free
|
return e.free || !e.offset ? null : e; // returns null if entry is free
|
||||||
},
|
},
|
||||||
fetchIfRef: function XRef_fetchIfRef(obj) {
|
fetchIfRef: function XRef_fetchIfRef(obj) {
|
||||||
if (!isRef(obj))
|
if (!isRef(obj))
|
||||||
|
1
test/pdfs/issue845.pdf.link
Normal file
1
test/pdfs/issue845.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://www.mediafire.com/?k8t1he9aa1pt840
|
@ -619,6 +619,13 @@
|
|||||||
"link": true,
|
"link": true,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue845",
|
||||||
|
"file": "pdfs/issue845.pdf",
|
||||||
|
"md5": "89ddf9e63cac4fa2dedcfe32a62e5407",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": true,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue818",
|
{ "id": "issue818",
|
||||||
"file": "pdfs/issue818.pdf",
|
"file": "pdfs/issue818.pdf",
|
||||||
"md5": "dd2f8a5bd65164ad74da2b45a6ca90cc",
|
"md5": "dd2f8a5bd65164ad74da2b45a6ca90cc",
|
||||||
|
Loading…
Reference in New Issue
Block a user