From 29cb8818cde8fa928e5a3d0270a7160a4d7f9c2d Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Wed, 27 Jul 2022 21:02:48 +0000 Subject: [PATCH] [repacker] new coverage serialization in PairPosFormat1. --- src/graph/graph.hh | 2 +- src/graph/pairpos-graph.hh | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/graph/graph.hh b/src/graph/graph.hh index 435e51a9d..234a26159 100644 --- a/src/graph/graph.hh +++ b/src/graph/graph.hh @@ -552,7 +552,7 @@ struct graph_t auto& child = vertices_[child_id]; child.parents.push (new_parent_idx); - old_v.remove_real_link (child_id); + old_v.remove_real_link (child_id); // TODO: needs to include offset to ensure correct one removed child.remove_parent (old_parent_idx); } diff --git a/src/graph/pairpos-graph.hh b/src/graph/pairpos-graph.hh index 4576330e4..ed1ba0d55 100644 --- a/src/graph/pairpos-graph.hh +++ b/src/graph/pairpos-graph.hh @@ -127,7 +127,35 @@ struct PairPosFormat1 : public OT::Layout::GPOS_impl::PairPosFormat1_3iter (), hb_range ()) + | hb_filter ([&] (hb_pair_t p) { + return p.second >= start && p.second < end; + }) + | hb_map_retains_sorting (hb_first) + ; + + unsigned coverage_prime_id = c.create_node (coverage_size); + auto& coverage_prime_obj = c.graph.vertices_[coverage_prime_id].obj; + hb_serialize_context_t serializer = hb_serialize_context_t (coverage_prime_obj.head, + coverage_size); + Coverage_serialize (&serializer, new_coverage); + serializer.end_serialize (); + if (serializer.in_error ()) + return -1; + + hb_blob_ptr_t coverage_copy = serializer.copy_blob (); + memcpy (coverage_prime_obj.head, + coverage_copy.get (), + coverage_copy.get_length ()); + coverage_prime_obj.tail = coverage_prime_obj.head + coverage_copy.get_length (); + // TODO: add coverage as a child + return pair_pos_prime_id; }