From 3195c1832ac328140b8bd536bff2db9c2c87181a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 21 Mar 2023 15:46:35 +0100 Subject: [PATCH] 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 --- Userland/Libraries/LibGfx/Font/OpenType/Font.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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 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);