LibPDF: Detect CFF encodings with supplements

These are not yet actually parsed, but detecting them means we at least
don't fail to understand the *actual* format value, which was causing
some CFF fonts to fail to load.
This commit is contained in:
Rodrigo Tobar 2023-03-02 00:05:25 +08:00 committed by Andreas Kling
parent 9bca62c5fa
commit 4a20751ff6
Notes: sideshowbarker 2024-07-17 03:03:15 +09:00

View file

@ -412,7 +412,9 @@ PDFErrorOr<Vector<CFF::Glyph>> CFF::parse_charstrings(Reader&& reader, Vector<By
PDFErrorOr<Vector<u8>> CFF::parse_encoding(Reader&& reader)
{
Vector<u8> encoding_codes;
auto format = TRY(reader.try_read<Card8>());
auto format_raw = TRY(reader.try_read<Card8>());
// TODO: support encoding supplements when highest bit is set
auto format = format_raw & 0x7f;
if (format == 0) {
auto n_codes = TRY(reader.try_read<Card8>());
for (u8 i = 0; i < n_codes; i++) {