From 1f0b5d5b87b61a37bebd393c0d67cce0b4ccdcb9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 29 Aug 2021 17:26:52 -0400 Subject: Add horizontal displacement Apply horizontal displacements for superscripts and subscripts that are provided in font metrics. This noticably improves the placement of superscripts in italics. Currently, we only apply these displacements in post-processing, and ignore the width changes during line-breaking. This could be improved by moving the baseline handling into the line-breaking proper. --- pango/pango-glyph-item.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pango/pango-glyph-item.c') diff --git a/pango/pango-glyph-item.c b/pango/pango-glyph-item.c index c64bfa13..7eb1737d 100644 --- a/pango/pango-glyph-item.c +++ b/pango/pango-glyph-item.c @@ -130,6 +130,8 @@ pango_glyph_item_split (PangoGlyphItem *orig, pango_glyph_string_set_size (orig->glyphs, orig->glyphs->num_glyphs - num_glyphs); new->y_offset = orig->y_offset; + new->start_x_offset = orig->start_x_offset; + new->end_x_offset = -orig->start_x_offset; return new; } @@ -157,6 +159,8 @@ pango_glyph_item_copy (PangoGlyphItem *orig) result->item = pango_item_copy (orig->item); result->glyphs = pango_glyph_string_copy (orig->glyphs); result->y_offset = orig->y_offset; + result->start_x_offset = orig->start_x_offset; + result->end_x_offset = orig->end_x_offset; return result; } -- cgit v1.2.1