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.
This commit is contained in:
Andreas Kling 2023-08-16 13:23:13 +02:00
parent 149ab91040
commit 2971ae59d8
Notes: sideshowbarker 2024-07-17 09:37:30 +09:00

View file

@ -818,12 +818,12 @@ static ErrorOr<GlyfAndLocaTableBuffers> 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));