Merge pull request #8507 from Snuffleupagus/issue-8480
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)
This commit is contained in:
commit
f1f9d98519
@ -628,26 +628,26 @@ var Font = (function FontClosure() {
|
|||||||
}
|
}
|
||||||
} else if (isOpenTypeFile(file)) {
|
} else if (isOpenTypeFile(file)) {
|
||||||
// Sometimes the type/subtype can be a complete lie (see issue7598.pdf).
|
// Sometimes the type/subtype can be a complete lie (see issue7598.pdf).
|
||||||
type = subtype = 'OpenType';
|
subtype = 'OpenType';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
|
if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
|
||||||
type = 'CIDFontType0';
|
type = 'CIDFontType0';
|
||||||
}
|
}
|
||||||
if (subtype === 'OpenType') {
|
|
||||||
type = 'OpenType';
|
|
||||||
}
|
|
||||||
// Some CIDFontType0C fonts by mistake claim CIDFontType0.
|
// Some CIDFontType0C fonts by mistake claim CIDFontType0.
|
||||||
if (type === 'CIDFontType0') {
|
if (type === 'CIDFontType0') {
|
||||||
if (isType1File(file)) {
|
if (isType1File(file)) {
|
||||||
subtype = 'CIDFontType0';
|
subtype = 'CIDFontType0';
|
||||||
} else if (isOpenTypeFile(file)) {
|
} else if (isOpenTypeFile(file)) {
|
||||||
// Sometimes the type/subtype can be a complete lie (see issue6782.pdf).
|
// Sometimes the type/subtype can be a complete lie (see issue6782.pdf).
|
||||||
type = subtype = 'OpenType';
|
subtype = 'OpenType';
|
||||||
} else {
|
} else {
|
||||||
subtype = 'CIDFontType0C';
|
subtype = 'CIDFontType0C';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (subtype === 'OpenType' && type !== 'OpenType') {
|
||||||
|
type = 'OpenType';
|
||||||
|
}
|
||||||
|
|
||||||
var data;
|
var data;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -2144,11 +2144,12 @@ var Font = (function FontClosure() {
|
|||||||
|
|
||||||
var isTrueType = !tables['CFF '];
|
var isTrueType = !tables['CFF '];
|
||||||
if (!isTrueType) {
|
if (!isTrueType) {
|
||||||
// OpenType font
|
// OpenType font (skip composite fonts with non-default CID to GID map).
|
||||||
if ((header.version === 'OTTO' && !properties.composite) ||
|
if ((header.version === 'OTTO' &&
|
||||||
|
!(properties.composite && properties.cidToGidMap)) ||
|
||||||
!tables['head'] || !tables['hhea'] || !tables['maxp'] ||
|
!tables['head'] || !tables['hhea'] || !tables['maxp'] ||
|
||||||
!tables['post']) {
|
!tables['post']) {
|
||||||
// no major tables: throwing everything at CFFFont
|
// No major tables: throwing everything at `CFFFont`.
|
||||||
cffFile = new Stream(tables['CFF '].data);
|
cffFile = new Stream(tables['CFF '].data);
|
||||||
cff = new CFFFont(cffFile, properties);
|
cff = new CFFFont(cffFile, properties);
|
||||||
|
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -52,6 +52,7 @@
|
|||||||
!issue8125.pdf
|
!issue8125.pdf
|
||||||
!issue8372.pdf
|
!issue8372.pdf
|
||||||
!issue8424.pdf
|
!issue8424.pdf
|
||||||
|
!issue8480.pdf
|
||||||
!bad-PageLabels.pdf
|
!bad-PageLabels.pdf
|
||||||
!filled-background.pdf
|
!filled-background.pdf
|
||||||
!ArabicCIDTrueType.pdf
|
!ArabicCIDTrueType.pdf
|
||||||
|
BIN
test/pdfs/issue8480.pdf
Normal file
BIN
test/pdfs/issue8480.pdf
Normal file
Binary file not shown.
@ -1149,6 +1149,13 @@
|
|||||||
"link": false,
|
"link": false,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue8480",
|
||||||
|
"file": "pdfs/issue8480.pdf",
|
||||||
|
"md5": "769bc07bf8041d95667f2d32aaf75665",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": false,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "tutorial",
|
{ "id": "tutorial",
|
||||||
"file": "pdfs/tutorial.pdf",
|
"file": "pdfs/tutorial.pdf",
|
||||||
"md5": "6e122f618c27f3aa9a689423e3be6b8d",
|
"md5": "6e122f618c27f3aa9a689423e3be6b8d",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user