summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-03-21 15:46:35 +0100
committerAndreas Kling <kling@serenityos.org>2023-03-21 15:48:32 +0100
commit3195c1832ac328140b8bd536bff2db9c2c87181a (patch)
tree3eb8c29ff773efd07a387e8779d05d9fda86cacb
parenta7a1df42c726d98448faae7b1137de9d06736590 (diff)
downloadserenity-3195c1832ac328140b8bd536bff2db9c2c87181a.zip
LibWeb: Don't try to parse GPOS lookup types we don't understand yet
At the moment, we only understand lookup type 2 (pair adjustment) so let's ignore lookup tables with other types. This fixes an issue where we'd choke on Noto Sans versions that come with a chained context positioning lookup table (type 8). Fixes #17924
-rw-r--r--Userland/Libraries/LibGfx/Font/OpenType/Font.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp b/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp
index d4771384a1..51ef580aa2 100644
--- a/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp
+++ b/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp
@@ -1041,6 +1041,12 @@ Optional<i16> GPOS::glyph_kerning(u16 left_glyph_id, u16 right_glyph_id) const
dbgln_if(OPENTYPE_GPOS_DEBUG, " lookupFlag: {}", lookup.lookup_flag);
dbgln_if(OPENTYPE_GPOS_DEBUG, " subtableCount: {}", lookup.subtable_count);
+ // NOTE: We only support lookup type 2 (Pair adjustment) at the moment.
+ if (lookup.lookup_type != 2) {
+ dbgln_if(OPENTYPE_GPOS_DEBUG, "FIXME: Implement GPOS lookup type {}", lookup.lookup_type);
+ continue;
+ }
+
for (size_t j = 0; j < lookup.subtable_count; ++j) {
auto pair_pos_format_offset = lookup.subtable_offsets[j];
auto pair_pos_format_slice = lookup_slice.slice(pair_pos_format_offset);