Skip to content

Commit

Permalink
Merge pull request mozilla#7639 from Snuffleupagus/bug-1252420
Browse files Browse the repository at this point in the history
Replace empty CharStrings with '.notdef' in `Type1Font_wrap` to prevent OTS from rejecting the font (bug 1252420)
  • Loading branch information
brendandahl committed Sep 20, 2016
2 parents 9e927de + aadcbe9 commit 15e1ae4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
!bug1200096.pdf
!bug1068432.pdf
!bug1146106.pdf
!bug1252420.pdf
!issue5564_reduced.pdf
!canvas.pdf
!bug1132849.pdf
Expand Down
Binary file added test/pdfs/bug1252420.pdf
Binary file not shown.
7 changes: 7 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,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",
Expand Down

0 comments on commit 15e1ae4

Please sign in to comment.