Index: src/vte.c
===================================================================
RCS file: /cvs/gnome/vte/src/vte.c,v
retrieving revision 1.385
diff -u -r1.385 vte.c
--- src/vte.c	15 Sep 2003 18:51:29 -0000	1.385
+++ src/vte.c	6 Apr 2004 08:24:10 -0000
@@ -10426,6 +10426,7 @@
  * vte_terminal_set_font:
  * @terminal: a #VteTerminal
  * @font_desc: The #PangoFontDescription of the desired font.
+ * @anti_alias: Specify if anti aliasing of the fonts is to be used or not.
  *
  * Sets the font used for rendering all text displayed by the terminal,
  * overriding any fonts set using gtk_widget_modify_font().  The terminal
@@ -10435,8 +10436,9 @@
  *
  */
 void
-vte_terminal_set_font(VteTerminal *terminal,
-		      const PangoFontDescription *font_desc)
+vte_terminal_set_font_full(VteTerminal *terminal,
+		      const PangoFontDescription *font_desc,
+		      VteTerminalAntiAlias anti_alias)
 {
 	GtkWidget *widget;
 	PangoFontDescription *desc;
@@ -10475,7 +10477,11 @@
 	terminal->pvt->fontdesc = desc;
 
 	/* Set the drawing font. */
-	_vte_draw_set_text_font(terminal->pvt->draw, terminal->pvt->fontdesc);
+	if (anti_alias == VTE_ANTI_ALIAS_USE_DEFAULT) {
+		_vte_draw_set_text_font(terminal->pvt->draw, terminal->pvt->fontdesc);
+	} else {
+		_vte_draw_set_text_font_full(terminal->pvt->draw, terminal->pvt->fontdesc, anti_alias);
+	}
 	vte_terminal_apply_metrics(terminal,
 				   _vte_draw_get_text_width(terminal->pvt->draw),
 				   _vte_draw_get_text_height(terminal->pvt->draw),
@@ -10484,6 +10490,25 @@
 				   _vte_draw_get_text_ascent(terminal->pvt->draw));
 	/* Repaint with the new font. */
 	vte_invalidate_all(terminal);
+}
+
+/**
+ * vte_terminal_set_font:
+ * @terminal: a #VteTerminal
+ * @font_desc: The #PangoFontDescription of the desired font.
+ *
+ * Sets the font used for rendering all text displayed by the terminal,
+ * overriding any fonts set using gtk_widget_modify_font().  The terminal
+ * will immediately attempt to load the desired font, retrieve its
+ * metrics, and attempt to resize itself to keep the same number of rows
+ * and columns.
+ *
+ */
+void
+vte_terminal_set_font(VteTerminal *terminal,
+		      const PangoFontDescription *font_desc)
+{
+	vte_terminal_set_font_full(terminal, font_desc, VTE_ANTI_ALIAS_USE_DEFAULT);
 }
 
 /**
Index: src/vte.h
===================================================================
RCS file: /cvs/gnome/vte/src/vte.h,v
retrieving revision 1.71
diff -u -r1.71 vte.h
--- src/vte.h	15 Sep 2003 18:51:29 -0000	1.71
+++ src/vte.h	6 Apr 2004 08:24:10 -0000
@@ -113,6 +113,13 @@
 	VTE_ERASE_DELETE_SEQUENCE
 } VteTerminalEraseBinding;
 
+/* Values for the anti alias setting */
+typedef enum VteTerminalAntiAlias{
+	VTE_ANTI_ALIAS_USE_DEFAULT,
+	VTE_ANTI_ALIAS_FORCE_ENABLE,
+	VTE_ANTI_ALIAS_FORCE_DISABLE,
+} VteTerminalAntiAlias;
+
 /* The structure we return as the supplemental attributes for strings. */
 struct _VteCharAttributes {
 	long row, column;
@@ -236,6 +243,9 @@
 /* Set or retrieve the current font. */
 void vte_terminal_set_font(VteTerminal *terminal,
 			   const PangoFontDescription *font_desc);
+void vte_terminal_set_font_full(VteTerminal *terminal,
+			   const PangoFontDescription *font_desc,
+			   VteTerminalAntiAlias anti_alias);
 void vte_terminal_set_font_from_string(VteTerminal *terminal, const char *name);
 const PangoFontDescription *vte_terminal_get_font(VteTerminal *terminal);
 gboolean vte_terminal_get_using_xft(VteTerminal *terminal);
Index: src/vtedraw.c
===================================================================
RCS file: /cvs/gnome/vte/src/vtedraw.c,v
retrieving revision 1.15
diff -u -r1.15 vtedraw.c
--- src/vtedraw.c	16 Jun 2003 21:15:10 -0000	1.15
+++ src/vtedraw.c	6 Apr 2004 08:24:11 -0000
@@ -222,6 +222,16 @@
 	draw->impl->set_text_font(draw, fontdesc);
 }
 
+void
+_vte_draw_set_text_font_full(struct _vte_draw *draw,
+			const PangoFontDescription *fontdesc,
+			VteTerminalAntiAlias anti_alias)
+{
+	g_return_if_fail(draw->impl != NULL);
+	g_return_if_fail(draw->impl->set_text_font != NULL);
+	draw->impl->set_text_font_full(draw, fontdesc, anti_alias);
+}
+
 int
 _vte_draw_get_text_width(struct _vte_draw *draw)
 {
Index: src/vtedraw.h
===================================================================
RCS file: /cvs/gnome/vte/src/vtedraw.h,v
retrieving revision 1.8
diff -u -r1.8 vtedraw.h
--- src/vtedraw.h	16 Jun 2003 21:15:10 -0000	1.8
+++ src/vtedraw.h	6 Apr 2004 08:24:11 -0000
@@ -26,6 +26,7 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 #include "vtebg.h"
+#include "vte.h"
 
 G_BEGIN_DECLS
 
@@ -67,6 +68,7 @@
 	gboolean requires_repaint;
 	void (*clear)(struct _vte_draw *, gint, gint, gint, gint);
 	void (*set_text_font)(struct _vte_draw *, const PangoFontDescription *);
+	void (*set_text_font_full)(struct _vte_draw *, const PangoFontDescription *, VteTerminalAntiAlias);
 	int (*get_text_width)(struct _vte_draw *);
 	int (*get_text_height)(struct _vte_draw *);
 	int (*get_text_ascent)(struct _vte_draw *);
Index: src/vtexft.c
===================================================================
RCS file: /cvs/gnome/vte/src/vtexft.c,v
retrieving revision 1.18
diff -u -r1.18 vtexft.c
--- src/vtexft.c	16 Jun 2003 21:15:10 -0000	1.18
+++ src/vtexft.c	6 Apr 2004 08:24:12 -0000
@@ -529,8 +529,9 @@
 }
 
 static void
-_vte_xft_set_text_font(struct _vte_draw *draw,
-		       const PangoFontDescription *fontdesc)
+_vte_xft_set_text_font_full(struct _vte_draw *draw,
+		       const PangoFontDescription *fontdesc,
+		       VteTerminalAntiAlias anti_alias)
 {
 	GString *string;
 	XftFont *font;
@@ -539,6 +540,8 @@
 	gunichar wide_chars[] = {VTE_DRAW_DOUBLE_WIDE_CHARACTERS};
 	int i, n, width, height;
 	FcChar32 c;
+	FcBool fcb;
+	FcPattern *pattern;
 
 	data = (struct _vte_xft_data*) draw->impl_data;
 
@@ -548,6 +551,26 @@
 	}
 	data->font = _vte_xft_font_open(draw->widget, fontdesc);
 
+	if (anti_alias != VTE_ANTI_ALIAS_USE_DEFAULT) {
+		FcBool aa;
+
+		aa = (anti_alias == VTE_ANTI_ALIAS_FORCE_ENABLE ? 1: 0);
+		for (i = 0; i < data->font->patterns->len; i++) {
+			pattern = g_array_index(data->font->patterns, FcPattern *, i);
+
+			if (pattern == NULL) {
+				continue;
+			}
+
+			if (FcPatternGetBool(pattern, FC_ANTIALIAS, 0, &fcb) == FcResultNoMatch) {
+				FcPatternAddBool(pattern, FC_ANTIALIAS, aa);
+			} else if (fcb ^ aa) {
+				FcPatternDel(pattern, FC_ANTIALIAS);
+				FcPatternAddBool(pattern, FC_ANTIALIAS, aa);
+			}
+		}
+	}
+
 	draw->width = 1;
 	draw->height = 1;
 	draw->ascent = 1;
@@ -604,6 +627,14 @@
 #endif
 }
 
+static void
+_vte_xft_set_text_font(struct _vte_draw *draw,
+		       const PangoFontDescription *fontdesc)
+{
+	/* Not interested in explicitly stating anti alias */
+	_vte_xft_set_text_font_full(draw, fontdesc, VTE_ANTI_ALIAS_USE_DEFAULT);
+}
+
 static int
 _vte_xft_get_text_width(struct _vte_draw *draw)
 {
@@ -827,6 +858,7 @@
 	FALSE,
 	_vte_xft_clear,
 	_vte_xft_set_text_font,
+	_vte_xft_set_text_font_full,
 	_vte_xft_get_text_width,
 	_vte_xft_get_text_height,
 	_vte_xft_get_text_ascent,
