Browse Source

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.
Rodrigo Tobar 2 years ago
parent
commit
4a20751ff6
1 changed files with 3 additions and 1 deletions
  1. 3 1
      Userland/Libraries/LibPDF/Fonts/CFF.cpp

+ 3 - 1
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)
 PDFErrorOr<Vector<u8>> CFF::parse_encoding(Reader&& reader)
 {
 {
     Vector<u8> encoding_codes;
     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) {
     if (format == 0) {
         auto n_codes = TRY(reader.try_read<Card8>());
         auto n_codes = TRY(reader.try_read<Card8>());
         for (u8 i = 0; i < n_codes; i++) {
         for (u8 i = 0; i < n_codes; i++) {