From 1fa64c0c23ed86d60117198420587aee81fdc8d8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 23 Nov 2022 21:38:51 -0700 Subject: [PATCH] [gsubgpos] Conditionalize skippy on unsafe-to-concat --- src/hb-ot-layout-gsubgpos.hh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 4ef03350b..6f1c614eb 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -537,7 +537,9 @@ struct hb_ot_apply_context_t : assert (num_items > 0); /* The alternate condition below is faster at string boundaries, * but produces subpar "unsafe-to-concat" values. */ - unsigned stop = end - 1/*num_items*/; + unsigned stop = end - num_items; + if (c->buffer->flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT) + stop = end - 1; while (idx < stop) { idx++; @@ -573,7 +575,9 @@ struct hb_ot_apply_context_t : assert (num_items > 0); /* The alternate condition below is faster at string boundaries, * but produces subpar "unsafe-to-concat" values. */ - unsigned stop = 1 - 1/*num_items*/; + unsigned stop = 1 - num_items; + if (c->buffer->flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT) + stop = 1 - 1; while (idx > stop) { idx--;