[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.
pull/3665/head
Garret Rieger 3 years ago committed by Behdad Esfahbod
parent 29811a720c
commit af74ab452f
  1. 6
      src/hb-repacker.hh
  2. BIN
      test/api/fonts/repacker_expected.otf

@ -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 ())

Loading…
Cancel
Save