From 4fe90bb6126c22f589b46768d7754d65ae300c5e Mon Sep 17 00:00:00 2001 From: dekrain Date: Mon, 23 Sep 2024 05:00:57 +0200 Subject: [PATCH] Fix the character index used for getting a glyph attribute in basic shaping --- src/shape.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shape.rs b/src/shape.rs index b52f073c8e..75824a33d5 100644 --- a/src/shape.rs +++ b/src/shape.rs @@ -458,12 +458,12 @@ fn shape_skip( glyphs.extend( line[start_run..end_run] - .chars() + .char_indices() .enumerate() - .map(|(i, codepoint)| { + .map(|(i, (chr_idx, codepoint))| { let glyph_id = charmap.map(codepoint); let x_advance = glyph_metrics.advance_width(glyph_id); - let attrs = attrs_list.get_span(i); + let attrs = attrs_list.get_span(start_run + chr_idx); ShapeGlyph { start: i,