[repacker] new coverage serialization in PairPosFormat1.
This commit is contained in:
parent
8d63f60e5b
commit
29cb8818cd
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,35 @@ struct PairPosFormat1 : public OT::Layout::GPOS_impl::PairPosFormat1_3<SmallType
|
|||
}
|
||||
|
||||
|
||||
// TODO: serialize a new coverage table.
|
||||
unsigned coverage_id = c.graph.index_for_offset (this_index, &coverage);
|
||||
unsigned coverage_size = c.graph.vertices_[coverage_id].table_size ();
|
||||
OT::Layout::Common::Coverage* coverage_table =
|
||||
(OT::Layout::Common::Coverage*) c.graph.object (coverage_id).head;
|
||||
|
||||
auto new_coverage =
|
||||
+ hb_zip (coverage_table->iter (), hb_range ())
|
||||
| hb_filter ([&] (hb_pair_t<unsigned, unsigned> 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<char*> 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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue