Only special-case OpenType fonts with CFF data if it's both a composite (i.e. Type0) font and also has a non-default CID to GID map (issue 8480)

*As mentioned the last time that I touched this particular part of the font code, I'm sincerely hope that this doesn't cause any regressions!*

However, the patch passes all tests added in PRs 5770, 6270, and 7904 (and obviously all other tests as well). Furthermore, I've manually checked all the issues/bugs referenced in those PRs without finding any issues.

Fixes 8480.
This commit is contained in:
Jonas Jenwald 2017-06-09 18:51:31 +02:00
parent 999e30723d
commit 8b4a42e5b8
4 changed files with 12 additions and 3 deletions

View File

@ -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);

View File

@ -52,6 +52,7 @@
!issue8125.pdf
!issue8372.pdf
!issue8424.pdf
!issue8480.pdf
!bad-PageLabels.pdf
!filled-background.pdf
!ArabicCIDTrueType.pdf

BIN
test/pdfs/issue8480.pdf Normal file

Binary file not shown.

View File

@ -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",