diff --git a/src/core/fonts.js b/src/core/fonts.js index d44868274..faaf294d9 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -628,26 +628,26 @@ var Font = (function FontClosure() { } } else if (isOpenTypeFile(file)) { // Sometimes the type/subtype can be a complete lie (see issue7598.pdf). - type = subtype = 'OpenType'; + subtype = 'OpenType'; } } if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') { type = 'CIDFontType0'; } - if (subtype === 'OpenType') { - type = 'OpenType'; - } // Some CIDFontType0C fonts by mistake claim CIDFontType0. if (type === 'CIDFontType0') { if (isType1File(file)) { subtype = 'CIDFontType0'; } else if (isOpenTypeFile(file)) { // Sometimes the type/subtype can be a complete lie (see issue6782.pdf). - type = subtype = 'OpenType'; + subtype = 'OpenType'; } else { subtype = 'CIDFontType0C'; } } + if (subtype === 'OpenType' && type !== 'OpenType') { + type = 'OpenType'; + } var data; switch (type) { @@ -2144,11 +2144,12 @@ var Font = (function FontClosure() { var isTrueType = !tables['CFF ']; if (!isTrueType) { - // OpenType font - if ((header.version === 'OTTO' && !properties.composite) || + // OpenType font (skip composite fonts with non-default CID to GID map). + if ((header.version === 'OTTO' && + !(properties.composite && properties.cidToGidMap)) || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) { - // no major tables: throwing everything at CFFFont + // No major tables: throwing everything at `CFFFont`. cffFile = new Stream(tables['CFF '].data); cff = new CFFFont(cffFile, properties); diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 774e4d31a..2b907c6a7 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -52,6 +52,7 @@ !issue8125.pdf !issue8372.pdf !issue8424.pdf +!issue8480.pdf !bad-PageLabels.pdf !filled-background.pdf !ArabicCIDTrueType.pdf diff --git a/test/pdfs/issue8480.pdf b/test/pdfs/issue8480.pdf new file mode 100644 index 000000000..bb1773285 Binary files /dev/null and b/test/pdfs/issue8480.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 4f2f176a9..ca05b0312 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1149,6 +1149,13 @@ "link": false, "type": "eq" }, + { "id": "issue8480", + "file": "pdfs/issue8480.pdf", + "md5": "769bc07bf8041d95667f2d32aaf75665", + "rounds": 1, + "link": false, + "type": "eq" + }, { "id": "tutorial", "file": "pdfs/tutorial.pdf", "md5": "6e122f618c27f3aa9a689423e3be6b8d",