Browse Source

Merge pull request #6607 from Snuffleupagus/TrueType-without-cmap

Prevent `readCmapTable` from failing if the `cmap` is missing in TrueType fonts
Yury Delendik 10 years ago
parent
commit
5b2015b04b
  1. 9
      src/core/fonts.js
  2. 1
      test/pdfs/.gitignore
  3. BIN
      test/pdfs/TrueType_without_cmap.pdf
  4. 7
      test/test_manifest.json

9
src/core/fonts.js

@ -3226,6 +3226,15 @@ var Font = (function FontClosure() { @@ -3226,6 +3226,15 @@ var Font = (function FontClosure() {
* PDF spec
*/
function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
if (!cmap) {
warn('No cmap table available.');
return {
platformId: -1,
encodingId: -1,
mappings: [],
hasShortCmap: false
};
}
var segment;
var start = (font.start ? font.start : 0) + cmap.offset;
font.pos = start;

1
test/pdfs/.gitignore vendored

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
*.error
!tracemonkey.pdf
!TrueType_without_cmap.pdf
!franz.pdf
!franz_2.pdf
!xref_command_missing.pdf

BIN
test/pdfs/TrueType_without_cmap.pdf

Binary file not shown.

7
test/test_manifest.json

@ -1196,6 +1196,13 @@ @@ -1196,6 +1196,13 @@
"rounds": 1,
"type": "eq"
},
{ "id": "TrueType_without_cmap",
"file": "pdfs/TrueType_without_cmap.pdf",
"md5": "afca8bb11f2e1f7298b4e5dd85785fb0",
"link": false,
"rounds": 1,
"type": "eq"
},
{ "id": "issue3323",
"file": "pdfs/issue3323.pdf",
"md5": "1a14ff574013caeafa9d598269988764",

Loading…
Cancel
Save