From 0fe6d50dea9ae15086d292cc8af9770606f68b21 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 27 Aug 2021 10:27:25 -0400 Subject: Take kerning into account for ligature carets The ligature caret positions returned by hb_ot_layout_get_ligature_carets are 'unshaped' metrics. We need to take the kerning into account that is applied during shaping, and shows up in the glyphstring as x_offset. --- pango/glyphstring.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pango') diff --git a/pango/glyphstring.c b/pango/glyphstring.c index 74462d26..cda4cf40 100644 --- a/pango/glyphstring.c +++ b/pango/glyphstring.c @@ -538,10 +538,13 @@ pango_glyph_string_index_to_x (PangoGlyphString *glyphs, *x_pos = end_xpos + caret; else *x_pos = start_xpos + caret; + *x_pos += glyphs->glyphs[glyph_pos].geometry.x_offset; return; } } +fallback: + *x_pos = ((cluster_chars - cluster_offset) * start_xpos + cluster_offset * end_xpos) / cluster_chars; } -- cgit v1.2.1