From af74ab452f5796fb02d6a406a70033803781f17d Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Thu, 16 Jun 2022 18:12:09 +0000 Subject: [PATCH] [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. --- src/hb-repacker.hh | 6 ++---- test/api/fonts/repacker_expected.otf | Bin 1400 -> 1400 bytes 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/hb-repacker.hh b/src/hb-repacker.hh index 19c2c2f34..9e51d3c1c 100644 --- a/src/hb-repacker.hh +++ b/src/hb-repacker.hh @@ -1177,16 +1177,14 @@ inline hb_blob_t* hb_resolve_overflows (const T& packed, hb_tag_t table_tag, 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); + sorted_graph.sort_shortest_distance (); + if (!sorted_graph.will_overflow ()) { return sorted_graph.serialize (); } - sorted_graph.sort_shortest_distance (); - if ((table_tag == HB_OT_TAG_GPOS || table_tag == HB_OT_TAG_GSUB) && sorted_graph.will_overflow ()) diff --git a/test/api/fonts/repacker_expected.otf b/test/api/fonts/repacker_expected.otf index d34cc87c1e23dfdfafb3537d9a17a9304c0fc0d8..f96fde0ca94533d1249a2f5b695856815b5531b7 100644 GIT binary patch delta 140 zcmeyt^@D4}S;l$^1_1^x1||k61|C#ZIDw)rK-<9V%|1*z%mCI( B48s5b delta 140 zcmeyt^@D4}S;l%U1~~>D2F9Gkk~{_u1{MY&`2U}Q5lAtXq!yO|#eggzWMa@_U}Inf z^EiNf5at8RfMi*K@*p)}eQ-5wP