diff options
Diffstat (limited to 'pango/pango-renderer.c')
-rw-r--r-- | pango/pango-renderer.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c index f54e1282..7d165f82 100644 --- a/pango/pango-renderer.c +++ b/pango/pango-renderer.c @@ -289,7 +289,8 @@ add_underline (PangoRenderer *renderer, PangoFontMetrics *metrics, int base_x, int base_y, - PangoRectangle *ink_rect) + PangoRectangle *ink_rect, + PangoRectangle *logical_rect) { PangoRectangle *current_rect = &state->underline_rect; PangoRectangle new_rect; @@ -297,8 +298,8 @@ add_underline (PangoRenderer *renderer, int underline_thickness = pango_font_metrics_get_underline_thickness (metrics); int underline_position = pango_font_metrics_get_underline_position (metrics); - new_rect.x = base_x + ink_rect->x; - new_rect.width = ink_rect->width; + new_rect.x = base_x + logical_rect->x; + new_rect.width = logical_rect->width; new_rect.height = underline_thickness; new_rect.y = base_y; @@ -316,14 +317,13 @@ add_underline (PangoRenderer *renderer, new_rect.y += ink_rect->y + ink_rect->height + underline_thickness; break; } + int new_pos; if (renderer->underline == state->underline && new_rect.y == current_rect->y && new_rect.height == current_rect->height) { - current_rect->y = new_rect.y; current_rect->width = new_rect.x + new_rect.width - current_rect->x; - current_rect->height = new_rect.height; } else { @@ -340,7 +340,8 @@ add_strikethrough (PangoRenderer *renderer, PangoFontMetrics *metrics, int base_x, int base_y, - PangoRectangle *ink_rect) + PangoRectangle *ink_rect, + PangoRectangle *logical_rect) { PangoRectangle *current_rect = &state->strikethrough_rect; PangoRectangle new_rect; @@ -348,8 +349,8 @@ add_strikethrough (PangoRenderer *renderer, int strikethrough_thickness = pango_font_metrics_get_strikethrough_thickness (metrics); int strikethrough_position = pango_font_metrics_get_strikethrough_position (metrics); - new_rect.x = base_x + ink_rect->x; - new_rect.width = ink_rect->width; + new_rect.x = base_x + logical_rect->x; + new_rect.width = logical_rect->width; new_rect.y = base_y - strikethrough_position; new_rect.height = strikethrough_thickness; @@ -357,9 +358,7 @@ add_strikethrough (PangoRenderer *renderer, new_rect.y == current_rect->y && new_rect.height == current_rect->height) { - current_rect->y = new_rect.y; current_rect->width = new_rect.x + new_rect.width - current_rect->x; - current_rect->height = new_rect.height; } else { @@ -493,13 +492,18 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer, { ink_rect = shape_attr->ink_rect; logical_rect = shape_attr->logical_rect; + ink = &ink_rect; + logical = &logical_rect; glyph_string_width = shape_attr->logical_rect.width; } else { if (renderer->underline != PANGO_UNDERLINE_NONE || renderer->strikethrough) - ink = &ink_rect; + { + ink = &ink_rect; + logical = &logical_rect; + } pango_glyph_string_extents (run->glyphs, run->item->analysis.font, ink, logical); if (logical) @@ -550,12 +554,12 @@ pango_renderer_draw_layout_line (PangoRenderer *renderer, if (renderer->underline != PANGO_UNDERLINE_NONE) add_underline (renderer, &state,metrics, x + x_off, y - rise, - &ink_rect); + ink, logical); if (renderer->strikethrough) add_strikethrough (renderer, &state, metrics, x + x_off, y - rise, - &ink_rect); + ink, logical); pango_font_metrics_unref (metrics); } |