From 5a34114f9685680d4a8cdf85a8ac90172c5620d7 Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Thu, 8 Feb 2018 18:32:24 -0800 Subject: [PATCH] Add an extra entry to the end of the loca table to identify the end of the last glyph's data. --- src/hb-subset-glyf.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hb-subset-glyf.cc b/src/hb-subset-glyf.cc index d7edd750..49c52a91 100644 --- a/src/hb-subset-glyf.cc +++ b/src/hb-subset-glyf.cc @@ -72,8 +72,9 @@ _write_glyf_and_loca_prime (const OT::glyf::accelerator_t &glyf, hb_codepoint_t next_glyph = -1; hb_codepoint_t new_glyph_id = 0; + unsigned int end_offset; while (hb_set_next(glyph_ids, &next_glyph)) { - unsigned int start_offset, end_offset; + unsigned int start_offset; if (unlikely (!glyf.get_offsets (next_glyph, &start_offset, &end_offset))) { return false; } @@ -86,6 +87,10 @@ _write_glyf_and_loca_prime (const OT::glyf::accelerator_t &glyf, 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. + loca_prime[new_glyph_id].set(end_offset); + return true; } -- GitLab