Fix the character index used for getting a glyph attribute in basic shaping

This commit is contained in:
dekrain 2024-09-23 05:00:57 +02:00 • committed by Jeremy Soller
parent e8f567cf5b
commit 4fe90bb612

View file

@ -458,12 +458,12 @@ fn shape_skip(
glyphs.extend( glyphs.extend(
line[start_run..end_run] line[start_run..end_run]
.chars() .char_indices()
.enumerate() .enumerate()
.map(|(i, codepoint)| { .map(|(i, (chr_idx, codepoint))| {
let glyph_id = charmap.map(codepoint); let glyph_id = charmap.map(codepoint);
let x_advance = glyph_metrics.advance_width(glyph_id); 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 { ShapeGlyph {
start: i, start: i,