fix issues in ClassDefFormat1 serialize:

glyph ids in Iterator may be non-consecutive,
so the number in classValue might be larger than length of the Iterator
pull/2311/head
Qunxin Liu 5 years ago committed by Garret Rieger
parent 4a49b36a9e
commit c8cc1e378d
  1. 20
      src/hb-ot-layout-common.hh
  2. 2
      src/hb-ot-layout-gpos-table.hh
  3. BIN
      test/subset/data/expected/layout.gdef/Roboto-Regular.keep-gdef-gpos.1E00,303.ttf
  4. BIN
      test/subset/data/expected/layout.gdef/Roboto-Regular.keep-gdef-gpos.303.ttf
  5. BIN
      test/subset/data/expected/layout.gdef/Roboto-Regular.keep-gdef-gpos.309,20,30F.ttf
  6. BIN
      test/subset/data/expected/layout.gdef/Roboto-Regular.keep-gdef-gpos.323.ttf
  7. BIN
      test/subset/data/expected/layout.gdef/Roboto-Regular.keep-gdef-gpos.41,42,43.ttf
  8. 1
      test/subset/data/profiles/keep-gdef-gpos.txt
  9. 2
      test/subset/data/tests/layout.gdef.tests

@ -1644,9 +1644,19 @@ struct ClassDefFormat1
return_trace (true);
}
startGlyph = (*it).first;
classValue.serialize (c, + it
| hb_map (hb_second));
hb_codepoint_t glyph_min = (*it).first;
hb_codepoint_t glyph_max = + it
| hb_map (hb_first)
| hb_reduce (hb_max, 0u);
unsigned glyph_count = glyph_max - glyph_min + 1;
startGlyph = glyph_min;
classValue.serialize (c, glyph_count);
for (const hb_pair_t<hb_codepoint_t, unsigned>& gid_klass_pair : + it)
{
unsigned idx = gid_klass_pair.first - glyph_min;
classValue[idx] = gid_klass_pair.second;
}
return_trace (true);
}
@ -1654,7 +1664,7 @@ struct ClassDefFormat1
hb_map_t *klass_map = nullptr /*OUT*/) const
{
TRACE_SUBSET (this);
const hb_set_t &glyphset = klass_map ? *c->plan->glyphset () : *c->plan->_glyphset_gsub;
const hb_set_t &glyphset = *c->plan->_glyphset_gsub;
const hb_map_t &glyph_map = *c->plan->glyph_map;
hb_sorted_vector_t<HBGlyphID> glyphs;
@ -1823,7 +1833,7 @@ struct ClassDefFormat2
hb_map_t *klass_map = nullptr /*OUT*/) const
{
TRACE_SUBSET (this);
const hb_set_t &glyphset = klass_map ? *c->plan->glyphset () : *c->plan->_glyphset_gsub;
const hb_set_t &glyphset = *c->plan->_glyphset_gsub;
const hb_map_t &glyph_map = *c->plan->glyph_map;
hb_sorted_vector_t<HBGlyphID> glyphs;

@ -1240,7 +1240,7 @@ struct PairPosFormat2
})
;
const hb_set_t &glyphset = *c->plan->glyphset ();
const hb_set_t &glyphset = *c->plan->_glyphset_gsub;
const hb_map_t &glyph_map = *c->plan->glyph_map;
auto it =

@ -4,7 +4,7 @@ Roboto-Regular.ttf
PROFILES:
default.txt
drop-hints.txt
keep-gdef.txt
keep-gdef-gpos.txt
SUBSETS:
̃

Loading…
Cancel
Save