[repacker] more bug fixes.
This commit is contained in:
parent
1002a3dcd3
commit
65afed047d
|
@ -228,6 +228,17 @@ struct graph_t
|
||||||
return vertices_[i].obj;
|
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
|
* Generates a new topological sorting of graph ordered by the shortest
|
||||||
* distance to each node.
|
* distance to each node.
|
||||||
|
@ -541,6 +552,9 @@ struct graph_t
|
||||||
unsigned new_parent_idx,
|
unsigned new_parent_idx,
|
||||||
const O* new_offset)
|
const O* new_offset)
|
||||||
{
|
{
|
||||||
|
distance_invalid = true;
|
||||||
|
positions_invalid = true;
|
||||||
|
|
||||||
auto& old_v = vertices_[old_parent_idx];
|
auto& old_v = vertices_[old_parent_idx];
|
||||||
auto& new_v = vertices_[new_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;
|
+ subtable_indices.length * OT::Offset16::static_size;
|
||||||
char* buffer = (char*) hb_calloc (1, new_size);
|
char* buffer = (char*) hb_calloc (1, new_size);
|
||||||
c.add_buffer (buffer);
|
c.add_buffer (buffer);
|
||||||
|
memcpy (buffer, v.obj.head, v.table_size());
|
||||||
|
|
||||||
v.obj.head = buffer;
|
v.obj.head = buffer;
|
||||||
v.obj.tail = buffer + new_size;
|
v.obj.tail = buffer + new_size;
|
||||||
|
|
||||||
memcpy (buffer, v.obj.head, v.table_size());
|
|
||||||
|
|
||||||
Lookup* new_lookup = (Lookup*) buffer;
|
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;
|
unsigned offset_index = subTable.len;
|
||||||
for (unsigned subtable_id : subtable_indices)
|
for (unsigned subtable_id : subtable_indices)
|
||||||
{
|
{
|
||||||
|
@ -181,7 +181,7 @@ struct Lookup : public OT::Lookup
|
||||||
link->width = 2;
|
link->width = 2;
|
||||||
link->objidx = subtable_id;
|
link->objidx = subtable_id;
|
||||||
link->position = (char*) &new_lookup->subTable[offset_index++] -
|
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);
|
c.graph.vertices_[subtable_id].parents.push (this_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,11 +314,13 @@ hb_resolve_overflows (const T& packed,
|
||||||
{
|
{
|
||||||
if (recalculate_extensions)
|
if (recalculate_extensions)
|
||||||
{
|
{
|
||||||
|
DEBUG_MSG (SUBSET_REPACK, nullptr, "Splitting subtables if needed.");
|
||||||
if (!_presplit_subtables_if_needed (ext_context)) {
|
if (!_presplit_subtables_if_needed (ext_context)) {
|
||||||
DEBUG_MSG (SUBSET_REPACK, nullptr, "Subtable splitting failed.");
|
DEBUG_MSG (SUBSET_REPACK, nullptr, "Subtable splitting failed.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG_MSG (SUBSET_REPACK, nullptr, "Promoting lookups to extensions if needed.");
|
||||||
if (!_promote_extensions_if_needed (ext_context)) {
|
if (!_promote_extensions_if_needed (ext_context)) {
|
||||||
DEBUG_MSG (SUBSET_REPACK, nullptr, "Extensions promotion failed.");
|
DEBUG_MSG (SUBSET_REPACK, nullptr, "Extensions promotion failed.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -328,6 +330,8 @@ hb_resolve_overflows (const T& packed,
|
||||||
DEBUG_MSG (SUBSET_REPACK, nullptr, "Assigning spaces to 32 bit subgraphs.");
|
DEBUG_MSG (SUBSET_REPACK, nullptr, "Assigning spaces to 32 bit subgraphs.");
|
||||||
if (sorted_graph.assign_spaces ())
|
if (sorted_graph.assign_spaces ())
|
||||||
sorted_graph.sort_shortest_distance ();
|
sorted_graph.sort_shortest_distance ();
|
||||||
|
else
|
||||||
|
sorted_graph.sort_shortest_distance_if_needed ();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned round = 0;
|
unsigned round = 0;
|
||||||
|
|
Loading…
Reference in New Issue