Browse Source

Check that Type1C fonts does not actually contain OpenType font files (issue 7598)

This patch is yet another instalment in the (never ending) series of patches for PDF files that specify completely incorrect Type/Subtype for its fonts. In this case Type1/Type1C, when in fact OpenType would have been correct.

Fixes 7598.
Jonas Jenwald 9 years ago
parent
commit
44b75c01a1
  1. 17
      src/core/fonts.js
  2. 1
      test/pdfs/.gitignore
  3. BIN
      test/pdfs/issue7598.pdf
  4. 7
      test/test_manifest.json

17
src/core/fonts.js

@ -689,12 +689,17 @@ var Font = (function FontClosure() {
} }
// Some fonts might use wrong font types for Type1C or CIDFontType0C // Some fonts might use wrong font types for Type1C or CIDFontType0C
if (subtype === 'Type1C' && (type !== 'Type1' && type !== 'MMType1')) { if (subtype === 'Type1C') {
// Some TrueType fonts by mistake claim Type1C if (type !== 'Type1' && type !== 'MMType1') {
if (isTrueTypeFile(file)) { // Some TrueType fonts by mistake claim Type1C
subtype = 'TrueType'; if (isTrueTypeFile(file)) {
} else { subtype = 'TrueType';
type = 'Type1'; } else {
type = 'Type1';
}
} else if (isOpenTypeFile(file)) {
// Sometimes the type/subtype can be a complete lie (see issue7598.pdf).
type = subtype = 'OpenType';
} }
} }
if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') { if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {

1
test/pdfs/.gitignore vendored

@ -35,6 +35,7 @@
!issue7439.pdf !issue7439.pdf
!issue7446.pdf !issue7446.pdf
!issue7492.pdf !issue7492.pdf
!issue7598.pdf
!filled-background.pdf !filled-background.pdf
!ArabicCIDTrueType.pdf !ArabicCIDTrueType.pdf
!ThuluthFeatures.pdf !ThuluthFeatures.pdf

BIN
test/pdfs/issue7598.pdf

Binary file not shown.

7
test/test_manifest.json

@ -1795,6 +1795,13 @@
"link": false, "link": false,
"type": "eq" "type": "eq"
}, },
{ "id": "issue7598",
"file": "pdfs/issue7598.pdf",
"md5": "c5bc5a779bfcb4b234f853231b56cf60",
"rounds": 1,
"link": false,
"type": "eq"
},
{ "id": "issue7439", { "id": "issue7439",
"file": "pdfs/issue7439.pdf", "file": "pdfs/issue7439.pdf",
"md5": "56682657990a894c66db26560d3039d7", "md5": "56682657990a894c66db26560d3039d7",

Loading…
Cancel
Save