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.
This commit is contained in:
Andreas Kling 2024-01-06 21:13:39 +01:00
parent e7eaf3b566
commit d26ad8450f
Notes: sideshowbarker 2024-07-17 09:48:50 +09:00

View file

@ -266,7 +266,7 @@ ErrorOr<Kern> 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<Format0 const>());
auto pairs = TRY(stream.read_in_place<Format0Pair const>(5));
auto pairs = TRY(stream.read_in_place<Format0Pair const>(format0_header.n_pairs));
subtables.append(Subtable {
.header = subtable_header,