[repack] always run the sort in repack.

This is needed to ensure virtual link ordering constraints are respected when repack is being called from fontTools. For subset usage, repack won't be called if the graph doesn't already overflow so this change doesn't cause any extra work.
This commit is contained in:
Garret Rieger 2022-06-16 18:12:09 +00:00 committed by Behdad Esfahbod
parent 29811a720c
commit af74ab452f
2 changed files with 2 additions and 4 deletions

View File

@ -1177,16 +1177,14 @@ inline hb_blob_t*
hb_resolve_overflows (const T& packed, hb_resolve_overflows (const T& packed,
hb_tag_t table_tag, hb_tag_t table_tag,
unsigned max_rounds = 20) { unsigned max_rounds = 20) {
// Kahn sort is ~twice as fast as shortest distance sort and works for many fonts
// so try it first to save time.
graph_t sorted_graph (packed); graph_t sorted_graph (packed);
sorted_graph.sort_shortest_distance ();
if (!sorted_graph.will_overflow ()) if (!sorted_graph.will_overflow ())
{ {
return sorted_graph.serialize (); return sorted_graph.serialize ();
} }
sorted_graph.sort_shortest_distance ();
if ((table_tag == HB_OT_TAG_GPOS if ((table_tag == HB_OT_TAG_GPOS
|| table_tag == HB_OT_TAG_GSUB) || table_tag == HB_OT_TAG_GSUB)
&& sorted_graph.will_overflow ()) && sorted_graph.will_overflow ())

Binary file not shown.