From 2971ae59d8784f9be3894f2ef485aefa51fe0143 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 16 Aug 2023 13:23:13 +0200 Subject: [PATCH] LibGfx/WOFF2: Align all reconstructed glyf entries to 4 bytes It wasn't enough to do it only for simple glyphs, we need to do it for composite glyphs as well. Fixes an issue where some glyph data was misaligned in the output and thus ended up rendered incorrectly or not at all. --- Userland/Libraries/LibGfx/Font/WOFF2/Font.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibGfx/Font/WOFF2/Font.cpp b/Userland/Libraries/LibGfx/Font/WOFF2/Font.cpp index 9af2def185..17f0bb7a2f 100644 --- a/Userland/Libraries/LibGfx/Font/WOFF2/Font.cpp +++ b/Userland/Libraries/LibGfx/Font/WOFF2/Font.cpp @@ -818,12 +818,12 @@ static ErrorOr create_glyf_and_loca_tables_from_transfo TRY(append_i16(point.y)); } } + } - // NOTE: Make sure each glyph starts on a 4-byte boundary. - // I haven't found the spec text for this, but it matches other implementations. - while (reconstructed_glyf_table.size() % 4 != 0) { - TRY(reconstructed_glyf_table.try_append(0)); - } + // NOTE: Make sure each glyph starts on a 4-byte boundary. + // I haven't found the spec text for this, but it matches other implementations. + while (reconstructed_glyf_table.size() % 4 != 0) { + TRY(reconstructed_glyf_table.try_append(0)); } TRY(loca_indexes.try_append(starting_glyf_table_size));