[repacker] Use hb_pair_t constructor instead of hb_pair ().

hb_pair was causing corrupted gid values.
This commit is contained in:
Garret Rieger 2022-08-04 21:36:21 +00:00
parent fdd1952c75
commit 506547c958
1 changed files with 4 additions and 4 deletions

View File

@ -351,19 +351,19 @@ struct PairPosFormat2 : public OT::Layout::GPOS_impl::PairPosFormat2_4<SmallType
ClassDef* class_def_1_table = (ClassDef*) class_def_1_v.obj.head; ClassDef* class_def_1_table = (ClassDef*) class_def_1_v.obj.head;
if (!coverage_table->sanitize (coverage_v) if (!coverage_table->sanitize (coverage_v)
|| !class_def_1_table->sanitize (class_def_1_v)) || !class_def_1_table->sanitize (class_def_1_v))
return false; return -1;
auto klass_map = auto klass_map =
+ coverage_table->iter () + coverage_table->iter ()
| hb_map_retains_sorting ([&] (hb_codepoint_t gid) { | hb_map_retains_sorting ([&] (hb_codepoint_t gid) {
return hb_pair (gid, class_def_1_table->get_class (gid)); return hb_pair_t<hb_codepoint_t, hb_codepoint_t> (gid, class_def_1_table->get_class (gid));
}) })
| hb_filter ([&] (hb_codepoint_t klass) { | hb_filter ([&] (hb_codepoint_t klass) {
return klass >= start && klass < end; return klass >= start && klass < end;
}, hb_second) }, hb_second)
| hb_map_retains_sorting ([&] (hb_pair_t<hb_codepoint_t, hb_codepoint_t> gid_and_class) { | hb_map_retains_sorting ([&] (hb_pair_t<hb_codepoint_t, hb_codepoint_t> gid_and_class) {
// Classes must be from 0...N so subtract start // Classes must be from 0...N so subtract start
return hb_pair (gid_and_class.first, gid_and_class.second - start); return hb_pair_t<hb_codepoint_t, hb_codepoint_t> (gid_and_class.first, gid_and_class.second - start);
}) })
; ;
@ -492,7 +492,7 @@ struct PairPosFormat2 : public OT::Layout::GPOS_impl::PairPosFormat2_4<SmallType
auto klass_map = auto klass_map =
+ coverage_table->iter () + coverage_table->iter ()
| hb_map_retains_sorting ([&] (hb_codepoint_t gid) { | hb_map_retains_sorting ([&] (hb_codepoint_t gid) {
return hb_pair (gid, class_def_1_table->get_class (gid)); return hb_pair_t<hb_codepoint_t, hb_codepoint_t> (gid, class_def_1_table->get_class (gid));
}) })
| hb_filter ([&] (hb_codepoint_t klass) { | hb_filter ([&] (hb_codepoint_t klass) {
return klass < count; return klass < count;