From aed36a609c6163df378e7e266d470c8986b854ec Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Mon, 8 May 2023 18:09:47 +0200 Subject: [PATCH] Fix: [ICU] crash when trying to break a non-breaking run (#10791) Clusters from harfbuzz are indexed from the start of the buffer, not from the start of the run analyzed. This confuses other parts of the code that do assume they are from the start of the run. --- src/gfx_layout_icu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gfx_layout_icu.cpp b/src/gfx_layout_icu.cpp index c7bdf1016f..12bf5d28b2 100644 --- a/src/gfx_layout_icu.cpp +++ b/src/gfx_layout_icu.cpp @@ -208,7 +208,7 @@ void ICURun::Shape(UChar *buff, size_t buff_length) { x_advance = glyph_pos[i].x_advance / FONT_SCALE; } - this->glyph_to_char.push_back(glyph_info[i].cluster); + this->glyph_to_char.push_back(glyph_info[i].cluster - this->start); this->advance.push_back(x_advance); advance += x_advance; }