diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-08-29 17:26:52 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-08-31 14:29:56 -0400 |
commit | 1f0b5d5b87b61a37bebd393c0d67cce0b4ccdcb9 (patch) | |
tree | 1d9e1e3586a1f3b907385aa1c22a4c3456f147e4 /pango/pango-renderer.c | |
parent | 1b73eedc69bc15941f216bff11817b825adb51d8 (diff) | |
download | pango-1f0b5d5b87b61a37bebd393c0d67cce0b4ccdcb9.tar.gz |
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.
Diffstat (limited to 'pango/pango-renderer.c')
-rw-r--r-- | pango/pango-renderer.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c index 231ebe7d..d47ba13a 100644 --- a/pango/pango-renderer.c +++ b/pango/pango-renderer.c @@ -580,7 +580,6 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer, gboolean got_overall = FALSE; PangoRectangle overall_rect; const char *text; - int y_off; g_return_if_fail (PANGO_IS_RENDERER_FAST (renderer)); @@ -612,6 +611,7 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer, PangoAttrShape *shape_attr; PangoRectangle ink_rect, *ink = NULL; PangoRectangle logical_rect, *logical = NULL; + int y_off; if (run->item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE) logical = &logical_rect; @@ -651,6 +651,7 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer, state.logical_rect_end = x + x_off + glyph_string_width; + x_off += run->start_x_offset; y_off = run->y_offset; if (run->item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE) @@ -730,6 +731,7 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer, draw_strikethrough (renderer, &state); x_off += glyph_string_width; + x_off += run->end_x_offset; } /* Finish off any remaining underlines |