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.
This commit is contained in:
Jonas Jenwald 2016-09-17 14:36:42 +02:00
parent 4acd31f51e
commit aadcbe98c8
4 changed files with 16 additions and 1 deletions

View File

@ -3296,7 +3296,14 @@ var Type1Font = (function Type1FontClosure() {
var charStringsIndex = new CFFIndex(); var charStringsIndex = new CFFIndex();
charStringsIndex.add([0x8B, 0x0E]); // .notdef charStringsIndex.add([0x8B, 0x0E]); // .notdef
for (i = 0; i < count; i++) { 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; cff.charStrings = charStringsIndex;

View File

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

BIN
test/pdfs/bug1252420.pdf Normal file

Binary file not shown.

View File

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