Index: vte/src/vtexft.c
===================================================================
--- vte.orig/src/vtexft.c	2008-06-21 18:13:39.000000000 -0700
+++ vte/src/vtexft.c	2008-06-21 18:13:44.000000000 -0700
@@ -65,6 +65,7 @@
 
 struct _vte_xft_data {
 	struct _vte_xft_font *font;
+	struct _vte_xft_font *font_bold;
 	Display *display;
 	Drawable drawable;
 	int x_offs, y_offs;
@@ -631,8 +632,9 @@
 	XFreeGC (data->display, gc);
 }
 
-static void
-_vte_xft_set_text_font (struct _vte_draw *draw,
+static gboolean
+_vte_xft_set_text_font_prepare (struct _vte_draw *draw,
+		       struct _vte_xft_font **fontptr,
 		       const PangoFontDescription *fontdesc,
 		       VteTerminalAntiAlias antialias)
 {
@@ -643,22 +645,17 @@
 
 	ft = _vte_xft_font_open (draw->widget, fontdesc, antialias);
 	if (ft != NULL) {
-		if (data->font != NULL) {
-			_vte_xft_unlock_fonts (data->font);
-			_vte_xft_font_close (data->font);
+		if (*fontptr != NULL) {
+			_vte_xft_unlock_fonts (*fontptr);
+			_vte_xft_font_close (*fontptr);
 		}
-		data->font = ft;
+		*fontptr = ft;
 	}
-	if (data->font == NULL) {
-		return;
+	if (*fontptr == NULL) {
+		return FALSE;
 	}
 
-
-	if (data->font->have_metrics) {
-		draw->width = data->font->width;
-		draw->height = data->font->height;
-		draw->ascent = data->font->ascent;
-	} else {
+	if (!(*fontptr)->have_metrics) {
 		XftFont *font, *prev_font;
 		XGlyphInfo extents;
 		gunichar wide_chars[] = {VTE_DRAW_DOUBLE_WIDE_CHARACTERS};
@@ -666,9 +663,9 @@
 		gint n, width, height, min = G_MAXINT, max = G_MININT;
 		FcChar32 c;
 
-		draw->width = 1;
-		draw->height = 1;
-		draw->ascent = 1;
+		gint font_width = 1;
+		gint font_height = 1;
+		gint font_ascent = 1;
 
 		gdk_error_trap_push ();
 		n = width = height = 0;
@@ -676,10 +673,10 @@
 		 * characters. */
 		for (i = 0; i < sizeof (VTE_DRAW_SINGLE_WIDE_CHARACTERS) - 1; i++) {
 			c = VTE_DRAW_SINGLE_WIDE_CHARACTERS[i];
-			font = _vte_xft_font_for_char (data->font, c);
+			font = _vte_xft_font_for_char (*fontptr, c);
 			if (font != NULL) {
 				memset (&extents, 0, sizeof (extents));
-				_vte_xft_text_extents (data->font, font, c, &extents);
+				_vte_xft_text_extents (*fontptr, font, c, &extents);
 				n++;
 				width += extents.xOff;
 				if (extents.xOff < min) {
@@ -694,10 +691,10 @@
 			}
 		}
 		if (n > 0) {
-			draw->width = howmany (width, n);
-			draw->height = (font != NULL) ?
+			font_width = howmany (width, n);
+			font_height = (font != NULL) ?
 				font->ascent + font->descent : height;
-			draw->ascent = (font != NULL) ?
+			font_ascent = (font != NULL) ?
 				font->ascent : height;
 		}
 		/* Estimate a typical cell width by looking at double-width
@@ -707,20 +704,20 @@
 		prev_font = NULL;
 		for (i = 0; i < G_N_ELEMENTS (wide_chars); i++) {
 			c = wide_chars[i];
-			font = _vte_xft_font_for_char (data->font, c);
+			font = _vte_xft_font_for_char (*fontptr, c);
 			if (font != NULL) {
 				if (n && prev_font != font) {/* font change */
 					width = howmany (width, n);
-					if (width >= draw->width -1 &&
-							width <= draw->width + 1){
+					if (width >= font_width -1 &&
+							width <= font_width + 1){
 						/* add 1 to round up when dividing by 2 */
-						draw->width = (draw->width + 1) / 2;
+						font_width = (font_width + 1) / 2;
 						break;
 					}
 					n = width = 0;
 				}
 				memset (&extents, 0, sizeof (extents));
-				_vte_xft_text_extents (data->font, font, c, &extents);
+				_vte_xft_text_extents (*fontptr, font, c, &extents);
 				n++;
 				width += extents.xOff;
 				prev_font = font;
@@ -728,26 +725,71 @@
 		}
 		if (n > 0) {
 			width = howmany (width, n);
-			if (width >= draw->width -1 &&
-					width <= draw->width + 1){
+			if (width >= font_width -1 &&
+					width <= font_width + 1){
 				/* add 1 to round up when dividing by 2 */
-				draw->width = (draw->width + 1) / 2;
+				font_width = (font_width + 1) / 2;
 			}
 		}
 
 		gdk_error_trap_pop ();
 
-		data->font->width = draw->width;
-		data->font->height = draw->height;
-		data->font->ascent = draw->ascent;
-		data->font->have_metrics = TRUE;
+		(*fontptr)->width = font_width;
+		(*fontptr)->height = font_height;
+		(*fontptr)->ascent = font_ascent;
+		(*fontptr)->have_metrics = TRUE;
 
 		_vte_debug_print (VTE_DEBUG_MISC,
 				"VteXft font metrics = %dx%d (%d),"
 				" width range [%d, %d].\n",
-				draw->width, draw->height, draw->ascent,
+				font_width, font_height, font_ascent,
 				min, max);
 	}
+	return TRUE;
+}
+
+static void
+_vte_xft_set_text_font (struct _vte_draw *draw,
+		       const PangoFontDescription *fontdesc,
+		       VteTerminalAntiAlias antialias)
+{
+	struct _vte_xft_data *data;
+
+	data = (struct _vte_xft_data*) draw->impl_data;
+
+	/* prepare regular font */
+	if (!_vte_xft_set_text_font_prepare(draw, &data->font, fontdesc, antialias) ||
+            !data->font) {
+		return;
+	}
+
+	/* calculate bold font desc */
+	PangoFontDescription *bolddesc = pango_font_description_copy (fontdesc);
+	if (!bolddesc) {
+		goto boldless;
+	}
+	pango_font_description_set_weight (bolddesc, PANGO_WEIGHT_BOLD);
+	
+	/* prepare bold font */
+	if (!_vte_xft_set_text_font_prepare(draw, &data->font_bold, bolddesc, antialias) ||
+            !data->font_bold) {
+		goto boldless;
+	}
+	pango_font_description_free (bolddesc);
+
+	draw->width = MAX(data->font->width, data->font_bold->width);
+	draw->height = MAX(data->font->height, data->font_bold->height);
+	draw->ascent = MAX(data->font->ascent, data->font_bold->ascent);
+	//draw->has_bold = TRUE;
+
+	return;
+
+boldless:
+	if (bolddesc) pango_font_description_free(bolddesc);
+	draw->width = data->font->width;
+	draw->height = data->font->height;
+	draw->ascent = data->font->ascent;
+	//draw->has_bold = FALSE;
 }
 
 static inline int
