LibPDF: Give CFF Glyph 0 the name .notdef

This is required by the CFF spec, and is consistent with what we do for
the encoding 24 lines down.

As far as I can tell, nothing in `Type1FontProgram::rasterize_glyph()`
or in Type1Font.cpp implements the "If an encoding maps to a character
name that does not exist in the Type 1 font pro- gram, the .notdef glyph
is substituted." line from the PDF 1.7 spec (in 5.5.5 Character
Encoding, Encodings for Type 1 Fonts) yet, so this does yet have an
effect.
This commit is contained in:
Nico Weber 2024-02-19 20:06:43 -05:00 committed by Tim Flynn
parent 0b457f90e0
commit 1cb450e9a3
Notes: sideshowbarker 2024-07-16 21:39:23 +09:00

View file

@ -251,8 +251,7 @@ PDFErrorOr<NonnullRefPtr<CFF>> CFF::create(ReadonlyBytes const& cff_bytes, RefPt
auto cid = 0;
TRY(cff->add_glyph(ByteString::formatted("{}", cid), move(glyphs[0])));
} else {
// FIXME: Shouldn't this use resolve_sid(0, strings) (".notdef") as name?
TRY(cff->add_glyph(0, move(glyphs[0])));
TRY(cff->add_glyph(".notdef", move(glyphs[0])));
}
continue;
}