From b262ebcc9c9539076d17751e9bae06a8fd5001ff Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 30 Aug 2017 17:25:10 -0700 Subject: [PATCH] [util] Fix cluster sweeping during --verify If *I* get this wrong in 2017, I have no idea how others get their head around cluster math... Fixes tests/arabic-fallback-shaping.tests --- util/options.hh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/util/options.hh b/util/options.hh index 42bb8c46e..b24ab0c8e 100644 --- a/util/options.hh +++ b/util/options.hh @@ -366,13 +366,18 @@ struct shape_options_t : option_group_t } else { - unsigned int cluster = info[end].cluster; if (forward) - while (text_end < num_chars && text[text_end].cluster != cluster) + { + unsigned int cluster = info[end].cluster; + while (text_end < num_chars && text[text_end].cluster < cluster) text_end++; + } else - while (text_start && text[text_start - 1].cluster != cluster) + { + unsigned int cluster = info[end - 1].cluster; + while (text_start && text[text_start - 1].cluster >= cluster) text_start--; + } } assert (text_start < text_end);