From be50779cda64d6b7bc8422d6b428892ca829733f Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Fri, 30 Apr 2021 12:59:17 -0700 Subject: [PATCH] [subset] correct ClassDef format determination. It was possible for glyph_min to be a glyph mapped to class zero which threw off the number of glyph calculation. --- src/hb-ot-layout-common.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index d4e82249d..0fc66d2cb 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -2308,11 +2308,13 @@ struct ClassDef template - bool serialize (hb_serialize_context_t *c, Iterator it) + bool serialize (hb_serialize_context_t *c, Iterator it_with_class_zero) { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); + auto it = + it_with_class_zero | hb_filter (hb_second); + unsigned format = 2; if (likely (it)) { @@ -2328,8 +2330,8 @@ struct ClassDef { hb_codepoint_t cur_gid = gid_klass_pair.first; unsigned cur_klass = gid_klass_pair.second; - if (cur_klass) num_glyphs++; - if (cur_gid == glyph_min || !cur_klass) continue; + num_glyphs++; + if (cur_gid == glyph_min) continue; if (cur_gid > glyph_max) glyph_max = cur_gid; if (cur_gid != prev_gid + 1 || cur_klass != prev_klass)