mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibPDF: Ignore unknown CFF operators
https://adobe-type-tools.github.io/font-tech-notes/pdfs/5177.Type2.pdf says "The behavior of undefined operators is unspecified." but https://learn.microsoft.com/en-us/typography/opentype/spec/cff2 says "When an unrecognized operator is encountered, it is ignored and the stack is cleared." Some type 0 CIDFontType0C fonts (i.e. CID-keyed non-OpenType CFF fonts) depend on the latter, even though they're governed by the former spec. Fixes rendering of text in 0000521.pdf (e.g. page 10 or 5). The font there has a bunch of 0 opcodes for some reason.
This commit is contained in:
parent
9f50ad9208
commit
dde11e1757
1 changed files with 10 additions and 1 deletions
|
@ -716,7 +716,16 @@ PDFErrorOr<Type1FontProgram::Glyph> Type1FontProgram::parse_glyph(ReadonlyBytes
|
|||
|
||||
default:
|
||||
dbgln("Unhandled command: {}", v);
|
||||
return error("Unhandled command");
|
||||
// https://adobe-type-tools.github.io/font-tech-notes/pdfs/5177.Type2.pdf
|
||||
// says "The behavior of undefined operators is unspecified." but
|
||||
// https://learn.microsoft.com/en-us/typography/opentype/spec/cff2
|
||||
// says "When an unrecognized operator is encountered, it is ignored and
|
||||
// the stack is cleared."
|
||||
//
|
||||
// Some type 0 CIDFontType0C fonts (i.e. CID-keyed non-OpenType CFF fonts)
|
||||
// depend on the latter, even though they're governed by the former spec.
|
||||
state.sp = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue