summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Tobar <rtobarc@gmail.com>2023-03-02 00:05:25 +0800
committerAndreas Kling <kling@serenityos.org>2023-03-02 12:18:53 +0100
commit4a20751ff62efeb788a8a4fb06313e4485fc2808 (patch)
treeca8d23057476a38744f3a1f813f83a073228c45c
parent9bca62c5fa1c2278a8684250a1175454cf32d85a (diff)
downloadserenity-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.cpp4
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++) {