[repacker] add classDef1 clone_range to PairPosFormat2 split.

pull/3779/head
Garret Rieger 2 years ago
parent 68b90153ea
commit 22eae32b3b
  1. 4
      src/graph/classdef-graph.hh
  2. 16
      src/graph/coverage-graph.hh
  3. 23
      src/graph/pairpos-graph.hh

@ -72,7 +72,7 @@ struct ClassDef : public OT::ClassDef
auto new_class_def =
+ glyphs
| hb_map_retains_sorting ([&] (hb_codepoint_t gid) {
return hb_pair (gid, class_def_table[gid]);
return hb_pair (gid, class_def_table->get_class (gid));
})
;
@ -98,7 +98,7 @@ struct ClassDef : public OT::ClassDef
{
char* buffer = (char*) hb_calloc (1, max_size);
hb_serialize_context_t serializer (buffer, max_size);
ClassDef_serialize (&serializer, glyph_and_class);
OT::ClassDef_serialize (&serializer, glyph_and_class);
serializer.end_serialize ();
if (serializer.in_error ())
{

@ -56,18 +56,18 @@ struct CoverageFormat2 : public OT::Layout::Common::CoverageFormat2_4<SmallTypes
struct Coverage : public OT::Layout::Common::Coverage
{
static bool clone_coverage (gsubgpos_graph_context_t& c,
unsigned coverage_id,
unsigned new_parent_id,
unsigned link_position,
unsigned start, unsigned end)
static Coverage* clone_coverage (gsubgpos_graph_context_t& c,
unsigned coverage_id,
unsigned new_parent_id,
unsigned link_position,
unsigned start, unsigned end)
{
unsigned coverage_size = c.graph.vertices_[coverage_id].table_size ();
auto& coverage_v = c.graph.vertices_[coverage_id];
Coverage* coverage_table = (Coverage*) coverage_v.obj.head;
if (!coverage_table->sanitize (coverage_v))
return false;
return nullptr;
auto new_coverage =
+ hb_zip (coverage_table->iter (), hb_range ())
@ -80,7 +80,7 @@ struct Coverage : public OT::Layout::Common::Coverage
unsigned coverage_prime_id = c.graph.new_node (nullptr, nullptr);
auto& coverage_prime_vertex = c.graph.vertices_[coverage_prime_id];
if (!make_coverage (c, new_coverage, coverage_prime_id, coverage_size))
return false;
return nullptr;
auto* coverage_link = c.graph.vertices_[new_parent_id].obj.real_links.push ();
coverage_link->width = SmallTypes::size;
@ -88,7 +88,7 @@ struct Coverage : public OT::Layout::Common::Coverage
coverage_link->position = link_position;
coverage_prime_vertex.parents.push (new_parent_id);
return true;
return (Coverage*) coverage_prime_vertex.obj.head;
}
template<typename It>

@ -311,14 +311,25 @@ struct PairPosFormat2 : public OT::Layout::GPOS_impl::PairPosFormat2_4<SmallType
unsigned coverage_id =
split_context.c.graph.index_for_offset (split_context.this_index, &coverage);
if (!Coverage::clone_coverage (split_context.c,
coverage_id,
pair_pos_prime_id,
2,
start, end))
Coverage* new_coverage = Coverage::clone_coverage (split_context.c,
coverage_id,
pair_pos_prime_id,
2,
start, end);
if (!new_coverage)
return -1;
// classDef1
unsigned class_def_1_id =
split_context.c.graph.index_for_offset (split_context.this_index, &classDef1);
if (!ClassDef::clone_class_def (split_context.c,
class_def_1_id,
pair_pos_prime_id,
8,
new_coverage->iter ()))
return -1;
// TODO: class def 1 (clone_classdef (start, end))
// TODO: class def 2 (just link to existing)
return -1; // TODO

Loading…
Cancel
Save