[repack] fix incorrect extension object bounds.
diff --git a/src/graph/graph.hh b/src/graph/graph.hh index 8afa570..c9aaec1 100644 --- a/src/graph/graph.hh +++ b/src/graph/graph.hh
@@ -310,41 +310,6 @@ } } - - /* - void promote_extension_lookups (const hb_set_t& subtable_indices) - { - const OT::GSUBGPOS* gstar = (OT::GSUBGPOS*) root ().obj.head; - - unsigned lookup_list_idx = index_for_offset (root_idx (), &(gstar->lookupList)); - const OT::LookupList<SmallTypes>* lookupList = - (OT::LookupList<SmallTypes>*) object (lookup_list_idx).head; - - - for (unsigned i = 0; i < lookupList->len; i++) - { - unsigned lookup_idx = index_for_offset (lookup_list_idx, &(lookupList->arrayZ[i])); - const OT::Lookup* lookup = (OT::Lookup*) object (lookup_idx).head; - - // TODO(grieger): use the correct type for GSUB vs GPOS - if (lookup->get_type () == 9) continue; // skip extensions - - for (unsigned j = 0; j < lookup->subTable.len; j++) - { - unsigned subtable_idx = index_for_offset (lookup_idx, &(lookup->subTable.arrayZ[j])); - if (subtable_indices.has (subtable_idx)) - promote_to_extension (lookup_idx); - } - } - } - - void promote_to_extension (unsigned lookup_idx) - { - DEBUG_MSG (SUBSET_REPACK, nullptr, "Promoting %d to extension lookup.", lookup_idx); - // TODO(garretrieger): implement me. - } - */ - unsigned index_for_offset(unsigned node_idx, const void* offset) const { const auto& node = object (node_idx); @@ -642,7 +607,6 @@ { positions_invalid = true; distance_invalid = true; - parents_invalid = true; // TODO: remove auto* clone = vertices_.push (); if (vertices_.in_error ()) {
diff --git a/src/graph/gsubgpos-graph.hh b/src/graph/gsubgpos-graph.hh index 5a3321b..3a3b4c3 100644 --- a/src/graph/gsubgpos-graph.hh +++ b/src/graph/gsubgpos-graph.hh
@@ -104,7 +104,7 @@ unsigned type = lookupType; unsigned extension_size = OT::ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>::static_size; unsigned start = buffer.length; - unsigned end = start + extension_size - 1; + unsigned end = start + extension_size; if (!buffer.resize (buffer.length + extension_size)) // TODO: resizing potentially invalidates existing head/tail pointers. return false; @@ -115,7 +115,11 @@ extension->extensionLookupType = type; extension->extensionOffset = 0; - unsigned ext_index = graph.new_node (&buffer[start], &buffer[end]); + unsigned type_prime = extension->extensionLookupType; + printf("Assigned type %d to extension\n", type_prime); + + unsigned ext_index = graph.new_node (&buffer.arrayZ[start], + &buffer.arrayZ[end]); if (ext_index == (unsigned) -1) return false; auto& lookup_vertex = graph.vertices_[lookup_index]; @@ -142,6 +146,7 @@ l->position = 4; l->bias = 0; + ext_vertex.parents.push (lookup_index); subtable_vertex.remap_parent (lookup_index, ext_index); return true;