From: Ben Pfaff Date: Thu, 30 Jul 2009 04:26:55 +0000 (-0700) Subject: output: Fix vertical alignment of text to a baseline in chart output. X-Git-Tag: sid-i386-build98~30 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9fc76ec1091b47b92aeb2143d6159dacf3b70b2;p=pspp-builds.git output: Fix vertical alignment of text to a baseline in chart output. This makes labels on pie charts look better, for example. --- diff --git a/src/output/charts/plot-chart.c b/src/output/charts/plot-chart.c index 8d499866..04c10c4d 100644 --- a/src/output/charts/plot-chart.c +++ b/src/output/charts/plot-chart.c @@ -122,14 +122,20 @@ chart_label (cairo_t *cr, int horz_justify, int vert_justify, else cairo_rel_move_to (cr, -width / 2.0, 0); } - if (vert_justify != 't') + if (vert_justify == 'x') + { + int baseline_pango = pango_layout_get_baseline (layout); + double baseline = (double) baseline_pango / PANGO_SCALE; + cairo_rel_move_to (cr, 0, -baseline); + } + else if (vert_justify != 't') { int height_pango; double height; pango_layout_get_size (layout, NULL, &height_pango); height = (double) height_pango / PANGO_SCALE; - if (vert_justify == 'b' || vert_justify == 'x') + if (vert_justify == 'b') cairo_rel_move_to (cr, 0, -height); else if (vert_justify == 'c') cairo_rel_move_to (cr, 0, -height / 2.0);