From 7ee6128902333716dd8d8df6e38a8d1ebacb0a46 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 13 Dec 2018 18:32:04 -0500 Subject: [PATCH] [subset] Fix ClassDefFormat1 subsetting --- src/hb-ot-layout-common.hh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index c95eca7..39f141f 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -1241,13 +1241,16 @@ struct ClassDefFormat1 inline bool subset (hb_subset_context_t *c) const { TRACE_SUBSET (this); + const hb_set_t &glyphset = *c->plan->glyphset; const hb_map_t &glyph_map = *c->plan->glyph_map; hb_vector_t glyphs; - hb_codepoint_t first_glyph = startGlyph; - unsigned int count = classValue.len; - glyphs.resize (count); - for (unsigned i = 0; i < count; i++) - glyphs[i].set (glyph_map[first_glyph + i]); + hb_codepoint_t start = startGlyph; + hb_codepoint_t end = start + classValue.len; + for (hb_codepoint_t g = start; g < end; g++) + { + if (!glyphset.has (g)) continue; + glyphs.push()->set (glyph_map[g]); + } c->serializer->err (glyphs.in_error ()); Supplier glyphs_supplier (glyphs); -- 2.7.4