Browse Source

Further adjust the heuristics used to detect OpenType font files with CFF data, to ensure that all Type0 fonts are handled the same way regardless of font Subtype (issue 7901)

Changing this particular code makes me somewhat nervous about regressions, since PR 5770 necessitated the follow-up PR 6270.
However, the patch passes all tests added in those PRs (and obviously all other tests). Furthermore, I've manually checked all the issues/bugs referenced in PRs 5770 and 6270 without finding any issues.

**Please note:** This patch fixes *only* the font bug, not the SVG conversion, present on pages two and three of the PDF file in issue 7901.
Jonas Jenwald 8 years ago
parent
commit
e963971244
  1. 4
      src/core/fonts.js
  2. 1
      test/pdfs/.gitignore
  3. BIN
      test/pdfs/issue7901.pdf
  4. 7
      test/test_manifest.json

4
src/core/fonts.js

@ -2252,7 +2252,7 @@ var Font = (function FontClosure() {
var isTrueType = !tables['CFF ']; var isTrueType = !tables['CFF '];
if (!isTrueType) { if (!isTrueType) {
// OpenType font // OpenType font
if ((header.version === 'OTTO' && properties.type !== 'CIDFontType2') || if ((header.version === 'OTTO' && !properties.composite) ||
!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
@ -2397,7 +2397,7 @@ var Font = (function FontClosure() {
return false; return false;
} }
if (properties.type === 'CIDFontType2') { if (properties.composite) {
var cidToGidMap = properties.cidToGidMap || []; var cidToGidMap = properties.cidToGidMap || [];
var isCidToGidMapEmpty = cidToGidMap.length === 0; var isCidToGidMapEmpty = cidToGidMap.length === 0;

1
test/pdfs/.gitignore vendored

@ -44,6 +44,7 @@
!issue7835.pdf !issue7835.pdf
!issue7855.pdf !issue7855.pdf
!issue7872.pdf !issue7872.pdf
!issue7901.pdf
!bad-PageLabels.pdf !bad-PageLabels.pdf
!filled-background.pdf !filled-background.pdf
!ArabicCIDTrueType.pdf !ArabicCIDTrueType.pdf

BIN
test/pdfs/issue7901.pdf

Binary file not shown.

7
test/test_manifest.json

@ -1113,6 +1113,13 @@
"rounds": 1, "rounds": 1,
"type": "eq" "type": "eq"
}, },
{ "id": "issue7901",
"file": "pdfs/issue7901.pdf",
"md5": "16059a3af6e81ae9272daa57ea03e6e9",
"rounds": 1,
"link": false,
"type": "eq"
},
{ "id": "tutorial", { "id": "tutorial",
"file": "pdfs/tutorial.pdf", "file": "pdfs/tutorial.pdf",
"md5": "6e122f618c27f3aa9a689423e3be6b8d", "md5": "6e122f618c27f3aa9a689423e3be6b8d",

Loading…
Cancel
Save