From 6836a821428b714b9f2e95d5c4ebbd73867d9a53 Mon Sep 17 00:00:00 2001 From: Rod Sheeter Date: Tue, 27 Feb 2018 20:51:12 -0800 Subject: [PATCH] [subset] remove WE_HAVE_INSTRUCTIONS from composites when dropping hints --- src/hb-subset-glyf.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/hb-subset-glyf.cc b/src/hb-subset-glyf.cc index 696a74de..03676668 100644 --- a/src/hb-subset-glyf.cc +++ b/src/hb-subset-glyf.cc @@ -180,7 +180,17 @@ _write_glyf_and_loca_prime (hb_subset_plan_t *plan, memcpy (glyf_prime_data_next + instruction_start - start_offset, glyf_data + instruction_end, end_offset - instruction_end); /* if the instructions end at the end this was a composite glyph */ if (instruction_end == end_offset) - ; // TODO(rsheeter) remove WE_HAVE_INSTRUCTIONS from last flags + { + /* remove WE_HAVE_INSTRUCTIONS from flags in dest */ + OT::glyf::CompositeGlyphHeader::Iterator composite_it; + if (unlikely (!OT::glyf::CompositeGlyphHeader::get_iterator (glyf_prime_data_next, length, &composite_it))) return false; + const OT::glyf::CompositeGlyphHeader *glyph; + do { + glyph = composite_it.current; + OT::HBUINT16 *flags = const_cast (&glyph->flags); + flags->set ( (uint16_t) *flags & ~OT::glyf::CompositeGlyphHeader::WE_HAVE_INSTRUCTIONS); + } while (composite_it.move_to_next()); + } else /* zero instruction length, which is just before instruction_start */ memset (glyf_prime_data_next + instruction_start - start_offset - 2, 0, 2); -- GitLab