1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:27:35 +00:00

LibPDF: Read Global subr data in CFF reader

This was the last piece of data we didn't read yet.
(We also don't yet support multiple fonts per CFF, but I haven't
found a PDF using that yet.)

We still don't do anything with it, but now we at least print a
warning if this data is there and we ignore it.
This commit is contained in:
Nico Weber 2023-10-17 09:42:21 -04:00 committed by Andreas Kling
parent 3be5719987
commit 46fd6fdfa3

View file

@ -216,8 +216,14 @@ PDFErrorOr<NonnullRefPtr<CFF>> CFF::create(ReadonlyBytes const& cff_bytes, RefPt
auto strings = TRY(parse_strings(reader));
// FIXME: CFF spec "16 Local/Global Subrs INDEXes"
// "Global subrs are stored in an INDEX structure which follows the String INDEX."
// CFF spec "16 Local/Global Subrs INDEXes"
// "Global subrs are stored in an INDEX structure which follows the String INDEX."
Vector<ByteBuffer> global_subroutines;
TRY(parse_index(reader, [&](ReadonlyBytes const& subroutine_bytes) -> PDFErrorOr<void> {
return TRY(global_subroutines.try_append(TRY(ByteBuffer::copy(subroutine_bytes))));
}));
if (!global_subroutines.is_empty())
dbgln("CFF data contains Global subrs, which aren't implemented yet"); // FIXME
// Create glyphs (now that we have the subroutines) and associate missing information to store them and their encoding
auto glyphs = TRY(parse_charstrings(Reader(cff_bytes.slice(charstrings_offset)), local_subroutines));