瀏覽代碼

LibGfx: Select a valid TTF cmap subtable for the Macintosh platform

While this subtable ID is supposed to be deprecated, it is used heavily
in PDF files.

It supports mapping one or two-byte values, with quite a large list of
encodings to tell you which one to expect.
For our use case, we ignore this encoding ID and just pick the first
subtable with this platform ID. Unsupported encodings will get caught
by Subtable::glyph_id_for_code_point() anyway.
Julian Offenhäuser 2 年之前
父節點
當前提交
0ff9f2b865
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      Userland/Libraries/LibGfx/Font/OpenType/Font.cpp

+ 3 - 0
Userland/Libraries/LibGfx/Font/OpenType/Font.cpp

@@ -510,6 +510,9 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_offset(ReadonlyBytes buffer, u3
                 cmap.set_active_index(i);
                 break;
             }
+        } else if (platform.value() == Cmap::Subtable::Platform::Macintosh) {
+            cmap.set_active_index(i);
+            break;
         }
     }