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)
This commit is contained in:
Tim van der Meij 2015-05-15 12:54:04 +02:00
commit 7da9626d16
4 changed files with 15 additions and 2 deletions

View File

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

View File

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

BIN
test/pdfs/bug1050040.pdf Normal file

Binary file not shown.

View File

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