diff options
author | Rodrigo Tobar <rtobarc@gmail.com> | 2023-03-02 00:05:25 +0800 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-03-02 12:18:53 +0100 |
commit | 4a20751ff62efeb788a8a4fb06313e4485fc2808 (patch) | |
tree | ca8d23057476a38744f3a1f813f83a073228c45c | |
parent | 9bca62c5fa1c2278a8684250a1175454cf32d85a (diff) | |
download | serenity-4a20751ff62efeb788a8a4fb06313e4485fc2808.zip |
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.
-rw-r--r-- | Userland/Libraries/LibPDF/Fonts/CFF.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibPDF/Fonts/CFF.cpp b/Userland/Libraries/LibPDF/Fonts/CFF.cpp index 5307c594e9..6abbba5994 100644 --- a/Userland/Libraries/LibPDF/Fonts/CFF.cpp +++ b/Userland/Libraries/LibPDF/Fonts/CFF.cpp @@ -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++) { |