[repacker] more bug fixes.

pull/3763/head
Garret Rieger 2 years ago
parent 1002a3dcd3
commit 65afed047d
  1. 14
      src/graph/graph.hh
  2. 8
      src/graph/gsubgpos-graph.hh
  3. 4
      src/hb-repacker.hh

@ -228,6 +228,17 @@ struct graph_t
return vertices_[i].obj;
}
/*
* Generates a new topological sorting of graph ordered by the shortest
* distance to each node if positions are marked as invalid.
*/
void sort_shortest_distance_if_needed ()
{
if (!positions_invalid) return;
sort_shortest_distance ();
}
/*
* Generates a new topological sorting of graph ordered by the shortest
* distance to each node.
@ -541,6 +552,9 @@ struct graph_t
unsigned new_parent_idx,
const O* new_offset)
{
distance_invalid = true;
positions_invalid = true;
auto& old_v = vertices_[old_parent_idx];
auto& new_v = vertices_[new_parent_idx];

@ -159,14 +159,14 @@ struct Lookup : public OT::Lookup
+ subtable_indices.length * OT::Offset16::static_size;
char* buffer = (char*) hb_calloc (1, new_size);
c.add_buffer (buffer);
memcpy (buffer, v.obj.head, v.table_size());
v.obj.head = buffer;
v.obj.tail = buffer + new_size;
memcpy (buffer, v.obj.head, v.table_size());
Lookup* new_lookup = (Lookup*) buffer;
new_lookup->subTable.len = subTable.len + subtable_indices.length;
new_lookup->subTable.len = subTable.len + subtable_indices.length;
unsigned offset_index = subTable.len;
for (unsigned subtable_id : subtable_indices)
{
@ -181,7 +181,7 @@ struct Lookup : public OT::Lookup
link->width = 2;
link->objidx = subtable_id;
link->position = (char*) &new_lookup->subTable[offset_index++] -
(char*) &new_lookup->subTable[0];
(char*) new_lookup;
c.graph.vertices_[subtable_id].parents.push (this_index);
}
}

@ -314,11 +314,13 @@ hb_resolve_overflows (const T& packed,
{
if (recalculate_extensions)
{
DEBUG_MSG (SUBSET_REPACK, nullptr, "Splitting subtables if needed.");
if (!_presplit_subtables_if_needed (ext_context)) {
DEBUG_MSG (SUBSET_REPACK, nullptr, "Subtable splitting failed.");
return nullptr;
}
DEBUG_MSG (SUBSET_REPACK, nullptr, "Promoting lookups to extensions if needed.");
if (!_promote_extensions_if_needed (ext_context)) {
DEBUG_MSG (SUBSET_REPACK, nullptr, "Extensions promotion failed.");
return nullptr;
@ -328,6 +330,8 @@ hb_resolve_overflows (const T& packed,
DEBUG_MSG (SUBSET_REPACK, nullptr, "Assigning spaces to 32 bit subgraphs.");
if (sorted_graph.assign_spaces ())
sorted_graph.sort_shortest_distance ();
else
sorted_graph.sort_shortest_distance_if_needed ();
}
unsigned round = 0;

Loading…
Cancel
Save