diff --git a/src/core/fonts.js b/src/core/fonts.js index 751183a93..9a3104421 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -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() { }; } - 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() { default: warn('Unknown/unsupported post table version ' + version); valid = false; + if (properties.defaultEncoding) { + glyphNames = properties.defaultEncoding; + } break; } properties.glyphNames = glyphNames; diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 7946c42e3..3880a33e9 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -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 diff --git a/test/pdfs/bug1050040.pdf b/test/pdfs/bug1050040.pdf new file mode 100644 index 000000000..8234544e1 Binary files /dev/null and b/test/pdfs/bug1050040.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index f20b9863a..4311d3c19 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -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",