diff --git a/src/graph/gsubgpos-graph.hh b/src/graph/gsubgpos-graph.hh index a42549655..98302ff75 100644 --- a/src/graph/gsubgpos-graph.hh +++ b/src/graph/gsubgpos-graph.hh @@ -183,10 +183,13 @@ struct Lookup : public OT::Lookup Lookup* new_lookup = (Lookup*) buffer; + unsigned shift = 0; new_lookup->subTable.len = subTable.len + new_subtable_count; for (const auto& p : subtable_ids) { - unsigned offset_index = p.first + 1; + unsigned offset_index = p.first + shift + 1; + shift += p.second.length; + for (unsigned subtable_id : p.second) { if (is_ext) @@ -220,11 +223,13 @@ struct Lookup : public OT::Lookup auto& v = c.graph.vertices_[this_index]; Lookup* lookup = (Lookup*) v.obj.head; + unsigned shift = 0; for (const auto& p : subtable_ids) { - unsigned insert_index = p.first; + unsigned insert_index = p.first + shift; unsigned pos_offset = p.second.length * OT::Offset16::static_size; unsigned insert_offset = (char*) &lookup->subTable[insert_index] - (char*) lookup; + shift += p.second.length; for (auto& l : v.obj.all_links_writer ()) { diff --git a/src/test-repacker.cc b/src/test-repacker.cc index 30fe44a4e..e9aea87a3 100644 --- a/src/test-repacker.cc +++ b/src/test-repacker.cc @@ -1907,6 +1907,9 @@ main (int argc, char **argv) test_resolve_with_basic_pair_pos_2_split (); test_resolve_with_pair_pos_2_split_with_device_tables (); + // TODO(grieger): have run overflow tests compare graph equality not final packed binary. + // TODO(grieger): split test where multiple subtables in one lookup are split to test link ordering. + // TODO(grieger): split test where coverage table in subtable that is being split is shared. // TODO(grieger): test with extensions already mixed in as well. // TODO(grieger): test two layer ext promotion setup. // TODO(grieger): test sorting by subtables per byte in ext. promotion.