From d26ad8450fa1c1868b1ac7b922b6af35552572ee Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 6 Jan 2024 21:13:39 +0100 Subject: [PATCH] LibGfx/OpenType: Read the correct number of pairs from kern table We were trying to read exactly 5 pairs for some reason, instead of the number specified by the format 0 header. Fixing this makes "OpenSans Condensed" load on my machine. --- Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp b/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp index 09d2b1dd11e..3dc111295dd 100644 --- a/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp +++ b/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp @@ -266,7 +266,7 @@ ErrorOr Kern::from_slice(ReadonlyBytes slice) auto subtable_format = (subtable_header.coverage & 0xFF00) >> 8; if (subtable_format == 0) { auto const& format0_header = *TRY(stream.read_in_place()); - auto pairs = TRY(stream.read_in_place(5)); + auto pairs = TRY(stream.read_in_place(format0_header.n_pairs)); subtables.append(Subtable { .header = subtable_header,