Browse Source

Merge pull request #3268 from yurydelendik/issue-3207

Fixes reading unordered Subrs in Type1
Brendan Dahl 12 years ago
parent
commit
59f2e71738
  1. 5
      src/fonts.js
  2. 1
      test/pdfs/issue3207.pdf.link
  3. 9
      test/test_manifest.json
  4. 1
      test/unit/font_spec.js

5
src/fonts.js

@ -5331,11 +5331,8 @@ var Type1Parser = (function Type1ParserClosure() {
case 'Subrs': case 'Subrs':
var num = this.readInt(); var num = this.readInt();
this.getToken(); // read in 'array' this.getToken(); // read in 'array'
for (var j = 0; j < num; ++j) { while ((token = this.getToken()) === 'dup') {
token = this.getToken(); // read in 'dup'
var index = this.readInt(); var index = this.readInt();
if (index > j)
j = index;
var length = this.readInt(); var length = this.readInt();
this.getToken(); // read in 'RD' or '-|' this.getToken(); // read in 'RD' or '-|'
var data = stream.makeSubStream(stream.pos + 1, length); var data = stream.makeSubStream(stream.pos + 1, length);

1
test/pdfs/issue3207.pdf.link

@ -0,0 +1 @@
https://www.eff.org/sites/default/files/filenode/DMCA/NTIA%20DMCA%20White%20Paper.pdf

9
test/test_manifest.json

@ -1144,6 +1144,15 @@
"rounds": 1, "rounds": 1,
"type": "eq" "type": "eq"
}, },
{ "id": "issue3207",
"file": "pdfs/issue3207.pdf",
"md5": "667248adae0462c7f5acc7757d97b720",
"link": true,
"firstPage": 1,
"lastPage": 1,
"rounds": 1,
"type": "eq"
},
{ "id": "issue2829", { "id": "issue2829",
"file": "pdfs/issue2829.pdf", "file": "pdfs/issue2829.pdf",
"md5": "f32b28cf8792f6ccc470446bfbb38584", "md5": "f32b28cf8792f6ccc470446bfbb38584",

1
test/unit/font_spec.js

@ -360,6 +360,7 @@ describe('font', function() {
'/ExpansionFactor 99\n' + '/ExpansionFactor 99\n' +
'/Subrs 1 array\n' + '/Subrs 1 array\n' +
'dup 0 1 RD x noaccess put\n'+ 'dup 0 1 RD x noaccess put\n'+
'end\n' +
'/CharStrings 46 dict dup begin\n' + '/CharStrings 46 dict dup begin\n' +
'/.notdef 1 RD x ND' + '\n' + '/.notdef 1 RD x ND' + '\n' +
'end'); 'end');

Loading…
Cancel
Save