Browse Source

Merge pull request #5901 from Snuffleupagus/bug-1050040

Fall back to the |defaultEncoding| when no valid "post" table is found in TrueType fonts (bug 1050040)
Tim van der Meij 10 years ago
parent
commit
7da9626d16
  1. 9
      src/core/fonts.js
  2. 1
      test/pdfs/.gitignore
  3. BIN
      test/pdfs/bug1050040.pdf
  4. 7
      test/test_manifest.json

9
src/core/fonts.js

@ -3250,7 +3250,10 @@ var Font = (function FontClosure() { @@ -3250,7 +3250,10 @@ var Font = (function FontClosure() {
}
}
if (!potentialTable) {
if (potentialTable) {
font.pos = start + potentialTable.offset;
}
if (!potentialTable || font.peekByte() === -1) {
warn('Could not find a preferred cmap table.');
return {
platformId: -1,
@ -3260,7 +3263,6 @@ var Font = (function FontClosure() { @@ -3260,7 +3263,6 @@ var Font = (function FontClosure() {
};
}
font.pos = start + potentialTable.offset;
var format = font.getUint16();
var length = font.getUint16();
var language = font.getUint16();
@ -3695,6 +3697,9 @@ var Font = (function FontClosure() { @@ -3695,6 +3697,9 @@ var Font = (function FontClosure() {
default:
warn('Unknown/unsupported post table version ' + version);
valid = false;
if (properties.defaultEncoding) {
glyphNames = properties.defaultEncoding;
}
break;
}
properties.glyphNames = glyphNames;

1
test/pdfs/.gitignore vendored

@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
!arial_unicode_ab_cidfont.pdf
!arial_unicode_en_cidfont.pdf
!asciihexdecode.pdf
!bug1050040.pdf
!canvas.pdf
!complex_ttf_font.pdf
!extgstate.pdf

BIN
test/pdfs/bug1050040.pdf

Binary file not shown.

7
test/test_manifest.json

@ -579,6 +579,13 @@ @@ -579,6 +579,13 @@
"link": false,
"type": "eq"
},
{ "id": "bug1050040",
"file": "pdfs/bug1050040.pdf",
"md5": "9076b29bd157e2646b457f29a4472a07",
"rounds": 1,
"link": false,
"type": "eq"
},
{ "id": "hudsonsurvey",
"file": "pdfs/hudsonsurvey.pdf",
"md5": "bf0e6576a7b6c2fe7485bce1b78e006f",

Loading…
Cancel
Save