From e8318188c0e53a267a01c45b0fc8d29ad775738a Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Mon, 12 Feb 2018 11:38:28 -0800 Subject: [PATCH] [subset] Fix loca generation, was previously writing the original glyph starting offset. --- src/hb-subset-glyf.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hb-subset-glyf.cc b/src/hb-subset-glyf.cc index cd886ea7..28f5f0c5 100644 --- a/src/hb-subset-glyf.cc +++ b/src/hb-subset-glyf.cc @@ -86,6 +86,7 @@ _write_glyf_and_loca_prime (const OT::glyf::accelerator_t &glyf, hb_codepoint_t new_glyph_id = 0; + unsigned int current_offset = 0; unsigned int end_offset = 0; for (unsigned int i = 0; i < glyph_ids.len; i++) { unsigned int start_offset; @@ -96,15 +97,16 @@ _write_glyf_and_loca_prime (const OT::glyf::accelerator_t &glyf, int length = end_offset - start_offset; memcpy (glyf_prime_data_next, glyf_data + start_offset, length); - _write_loca_entry (i, start_offset, use_short_loca, loca_prime_data); + _write_loca_entry (i, current_offset, use_short_loca, loca_prime_data); glyf_prime_data_next += length; + current_offset += length; new_glyph_id++; } // Add the last loca entry which doesn't correspond to a specific glyph // but identifies the end of the last glyphs data. - _write_loca_entry (new_glyph_id, end_offset, use_short_loca, loca_prime_data); + _write_loca_entry (new_glyph_id, current_offset, use_short_loca, loca_prime_data); return true; } -- GitLab