Browse Source

Replace empty CharStrings with '.notdef' in `Type1Font_wrap` to prevent OTS from rejecting the font (bug 1252420)

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1252420.
Jonas Jenwald 9 years ago
parent
commit
aadcbe98c8
  1. 9
      src/core/fonts.js
  2. 1
      test/pdfs/.gitignore
  3. BIN
      test/pdfs/bug1252420.pdf
  4. 7
      test/test_manifest.json

9
src/core/fonts.js

@ -3296,7 +3296,14 @@ var Type1Font = (function Type1FontClosure() { @@ -3296,7 +3296,14 @@ var Type1Font = (function Type1FontClosure() {
var charStringsIndex = new CFFIndex();
charStringsIndex.add([0x8B, 0x0E]); // .notdef
for (i = 0; i < count; i++) {
charStringsIndex.add(glyphs[i]);
var glyph = glyphs[i];
// If the CharString outline is empty, replace it with .notdef to
// prevent OTS from rejecting the font (fixes bug1252420.pdf).
if (glyph.length === 0) {
charStringsIndex.add([0x8B, 0x0E]); // .notdef
continue;
}
charStringsIndex.add(glyph);
}
cff.charStrings = charStringsIndex;

1
test/pdfs/.gitignore vendored

@ -51,6 +51,7 @@ @@ -51,6 +51,7 @@
!bug1200096.pdf
!bug1068432.pdf
!bug1146106.pdf
!bug1252420.pdf
!issue5564_reduced.pdf
!canvas.pdf
!bug1132849.pdf

BIN
test/pdfs/bug1252420.pdf

Binary file not shown.

7
test/test_manifest.json

@ -768,6 +768,13 @@ @@ -768,6 +768,13 @@
"link": false,
"type": "load"
},
{ "id": "bug1252420",
"file": "pdfs/bug1252420.pdf",
"md5": "f21c911b9b655972b06ef782a1fa6a17",
"rounds": 1,
"link": false,
"type": "eq"
},
{ "id": "hudsonsurvey",
"file": "pdfs/hudsonsurvey.pdf",
"md5": "bf0e6576a7b6c2fe7485bce1b78e006f",

Loading…
Cancel
Save