Index: src/print.c
===================================================================
RCS file: /cvs/gnome/gnumeric/src/print.c,v
retrieving revision 1.162
diff -u -r1.162 print.c
--- src/print.c	7 Sep 2004 05:49:47 -0000	1.162
+++ src/print.c	21 Sep 2004 18:08:48 -0000
@@ -269,10 +269,14 @@
 		  HFSide side, double y)
 {
 	char *text;
-	double x;
-	double len;
 	double header = 0, footer = 0, left = 0, right = 0;
-
+	double dpi=96; /* FIXME what is the dpi ? */
+	PangoLayout *layout;
+	PangoFontDescription *pango_font;
+	PangoAlignment alignment;
+	int pango_layout_width;
+	int pango_layout_height;
+	
 	/* Be really really anal in case Bug
 	 * http://bugs.gnome.org/db/82/8200.html exists
 	 */
@@ -289,27 +293,41 @@
 		return;
 	}
 
-	len = gnome_font_get_width_utf8 (pj->decoration_font, text);
-
-	print_info_get_margins   (pj->pi, &header, &footer, &left, &right);
+	layout = gnome_print_pango_create_layout (pj->print_context);
+	pango_font = gnome_font_get_pango_description (pj->decoration_font, dpi);
+	
+	print_info_get_margins (pj->pi, &header, &footer, &left, &right);
+	
 	switch (side){
-	case LEFT_HEADER:
-		x = left;
-		break;
-
-	case RIGHT_HEADER:
-		x = pj->width - right - len;
-		break;
-
-	case MIDDLE_HEADER:
-		x = (pj->x_points - len)/2 + left;
-		break;
-
-	default:
-		x = 0;
+		case LEFT_HEADER:
+			alignment = PANGO_ALIGN_LEFT;
+			break;
+	
+		case RIGHT_HEADER:
+			alignment = PANGO_ALIGN_RIGHT;
+			break;
+	
+		case MIDDLE_HEADER:
+			alignment = PANGO_ALIGN_CENTER;
+			break;
+	
+		default:
+			alignment = PANGO_ALIGN_LEFT;
 	}
-	gnome_print_moveto (pj->print_context, x, y);
-	gnome_print_show (pj->print_context, text);
+	
+	g_print (text);
+	pango_layout_set_font_description (layout, pango_font);
+	pango_layout_set_width (layout, (pj->width - left - right) * PANGO_SCALE);
+	pango_layout_set_alignment (layout, alignment);
+	pango_layout_set_text (layout, text, -1);
+	
+	pango_layout_get_pixel_size (layout, &pango_layout_width, &pango_layout_height);
+	
+	gnome_print_moveto (pj->print_context, left, y + pango_layout_height);
+	gnome_print_pango_layout (pj->print_context, layout);
+	
+	g_object_unref (layout);
+	pango_font_description_free (pango_font);
 	g_free (text);
 }
 
