diff -ruN jed-B0.99-12.orig/doc/txt/xrenderfont.txt jed-B0.99-12/doc/txt/xrenderfont.txt
--- jed-B0.99-12.orig/doc/txt/xrenderfont.txt	Thu Jan  1 01:00:00 1970
+++ jed-B0.99-12/doc/txt/xrenderfont.txt	Mon Mar 26 19:18:57 2001
@@ -0,0 +1,22 @@
+xrenderfont.txt for jed-B0.99-12-xrenderfont.patch 0.2
+
+XJed is able to utilise the X Render extensions in order to display
+anti-aliased fonts.  If you're going to use this, do the following easy
+steps:
+
+1. Read http://www.xfree86.org/~keithp/render/aafont.txt (and act)
+2. Make sure "xterm -fa mono" renders anti-aliased fonts
+3. Edit the jed src/Makefile (AFTER you've run configure) and modify the
+   XRENDERFONTLIBS variable.
+4. Edit the jed src/jed-feat XJED_XRENDERFONT variable
+5. Build JED
+6. With the newly compiled xjed, try something like:
+   xjed -fn mono -fs 16 masterpiece.c
+   If you don't specify -fs somenumber (facesize, e.g. -fs 12 or -fs 16) jed
+   will revert to traditional font rendering.  When -fs is specified, the -fn
+   parameter is treated as facename, so you can do things like:
+   xjed -fn trebuc -fs 16 bomb.c
+   
+This functionality was brought to you by:
+Charl P. Botha <http://cpbotha.net>
+March 26, 2001
diff -ruN jed-B0.99-12.orig/src/Makefile.in jed-B0.99-12/src/Makefile.in
--- jed-B0.99-12.orig/src/Makefile.in	Sun Oct 22 05:15:50 2000
+++ jed-B0.99-12/src/Makefile.in	Mon Mar 26 14:13:00 2001
@@ -49,6 +49,10 @@
 #GPMMOUSEO = gpmmouse.o
 #OBJGPMMOUSEO = $(OBJDIR)/$(GPMMOUSEO)
 
+# 2. XFree86 XRENDERFONT (Anti-aliased font) support for XJED
+#    Also modify "XJED_XRENDERFONT" in jed-feat.h
+#XRENDERFONTLIBS = -lXft -lXrender -lfreetype -lXext
+
 #---------------------------------------------------------------------------
 # S-Lang library location
 #---------------------------------------------------------------------------
@@ -138,7 +142,7 @@
 $(OBJDIR)/xjed : $(OBJS) $(OBJDIR)/xterm.o $(OBJDIR)/vterm.o
 	cd $(OBJDIR); \
 	$(CC) $(OFILES) xterm.o vterm.o -o xjed $(LDFLAGS) \
-	   $(SLANG_LIB) -lslang  $(XLIB) -lm
+	   $(SLANG_LIB) -lslang  $(XLIB) -lm $(XRENDERFONTLIBS)
 #
 rgrep: $(OBJDIR)/rgrep
 	@echo rgrep created in $(OBJDIR)
diff -ruN jed-B0.99-12.orig/src/jed-feat.h jed-B0.99-12/src/jed-feat.h
--- jed-B0.99-12.orig/src/jed-feat.h	Sun Oct 22 05:15:50 2000
+++ jed-B0.99-12/src/jed-feat.h	Mon Mar 26 14:16:54 2001
@@ -76,4 +76,11 @@
  */
 #define XJED_SET_WM_COMMAND	0
 
+/* Set this to non-zero if you want XJed to have the ability of
+ * rendering anti-aliased fonts by making use of the X Render
+ * extension.  You also need to uncomment and possibly modify 
+ * XRENDERFONTLIBS in src/Makefile
+ */
+#define XJED_XRENDERFONT 0
+
 #endif
diff -ruN jed-B0.99-12.orig/src/xterm.c jed-B0.99-12/src/xterm.c
--- jed-B0.99-12.orig/src/xterm.c	Sun Oct 22 05:15:58 2000
+++ jed-B0.99-12/src/xterm.c	Mon Mar 26 19:17:24 2001
@@ -27,6 +27,9 @@
 # include <X11/keysym.h>
 # include <X11/cursorfont.h>
 # include <X11/Intrinsic.h>
+# if XJED_XRENDERFONT
+#  include <X11/Xft/Xft.h>
+# endif
 # if !SKIP_LOCALE_CODE
 #  if XtSpecificationRelease >= 6
 #   define XJED_USE_R6IM
@@ -124,7 +127,13 @@
    XFontStruct *font;
    char *font_name;
    int font_height, font_width, font_base;
-
+#if XJED_XRENDERFONT
+   XftFont *xftfont;
+   XftDraw *xftdraw;
+   double face_size;
+   Pixel current_fg_pixel;
+   Pixel current_bg_pixel;
+#endif    
    /* GC info */
    GC_Info_Type *text_gc;
    GC current_gc;
@@ -180,6 +189,9 @@
 #define Default_Geometry "80x24"
 static char *This_Geometry = NULL;
 static char *This_Font_Name = "fixed";
+#if XJED_XRENDERFONT
+static char *This_Face_Size = "                           ";
+#endif
 static char *This_Border_Width_Name = "0";
 static char *This_MFG = "green";
 static char *This_MBG = "white";
@@ -191,6 +203,10 @@
 static int receive_selection (XEvent *);
 static int send_selection (XEvent *);
 
+#if XJED_XRENDERFONT
+XftColor *Pixel2XftColor(Pixel pixel);
+#endif
+
 static GC_Info_Type Default_GC_Info[JMAX_COLORS] = /*{{{*/
 {
      {NULL, 0, 0, "black", "white"},     /* NORMAL */
@@ -285,6 +301,9 @@
      {"BorderColor",	"bd", 	STRING_TYPE,	NULL,	NULL},
      {"Iconic",		"ic",	VOID_TYPE,	NULL,	&Iconic},
      {"xrm",		NULL,	STRING_TYPE,	NULL,	NULL},
+#if XJED_XRENDERFONT
+     {"facesize",	"fs",	STRING_TYPE,	NULL,	&This_Face_Size},
+#endif	
      {NULL,		NULL,	0,		NULL,	NULL}
 };
 
@@ -310,16 +329,34 @@
    ch = SLSMG_EXTRACT_CHAR(*s);
    color = SLSMG_EXTRACT_COLOR(*s);
 
+#if XJED_XRENDERFONT
+    if (XWin->face_size > 0)
+    {
+	if (!XWin->xftdraw)
+	{
+	  XWin->xftdraw = XftDrawCreate(This_XDisplay, This_XWindow, DefaultVisual(This_XDisplay, This_XScreen), XWin->color_map);
+	}
+	XftDrawRect (XWin->xftdraw, Pixel2XftColor(XWin->text_gc[color].bg),
+		     (XWin->cursor_col) * XWin->font_width + b, (XWin->cursor_row) * XWin->font_height /*+ b + XWin->font_base*/,
+		     XWin->font_width, XWin->font_height);
+	XftDrawString8(XWin->xftdraw, Pixel2XftColor(XWin->text_gc[color].fg), XWin->xftfont, (XWin->cursor_col) * XWin->font_width + b,
+		       (XWin->cursor_row) * XWin->font_height + b + XWin->font_base,
+		       &ch, 1);
+    }
+    else  
+#endif
    XDrawImageString(This_XDisplay, XWin->w,
 		    XWin->text_gc[color].gc,
 		    col * XWin->font_width + b,
 		    row * XWin->font_height + b + XWin->font_base,
 		    &ch, 1);
-
 }
 
 /*}}}*/
 
+
+
+
 /* This routine assumes that cursor is in the correct location.  The
    cursor is placed at the end of the string.  Even if we are unable to
  * write the string, make sure that the cursor is moved as if we did
@@ -338,7 +375,23 @@
      {
 	int b = XWin->border;
 	if (XWin->cursor_showing) hide_cursor ();
-	XDrawImageString(This_XDisplay, This_XWindow, XWin->current_gc,
+#if XJED_XRENDERFONT
+	if (XWin->face_size > 0)
+	{
+	    if (!XWin->xftdraw)
+	    {
+		XWin->xftdraw = XftDrawCreate(This_XDisplay, This_XWindow, DefaultVisual(This_XDisplay, This_XScreen), XWin->color_map);
+	    }
+	    XftDrawRect (XWin->xftdraw, Pixel2XftColor(XWin->current_bg_pixel),
+			 (XWin->cursor_col) * XWin->font_width + b, (XWin->cursor_row) * XWin->font_height /*+ b + XWin->font_base*/,
+			 n * XWin->font_width, XWin->font_height);
+	    XftDrawString8(XWin->xftdraw, Pixel2XftColor(XWin->current_fg_pixel), XWin->xftfont, (XWin->cursor_col) * XWin->font_width + b,
+			   (XWin->cursor_row) * XWin->font_height + b + XWin->font_base,
+			   s, n);
+	}
+	else
+#endif	   
+	 XDrawImageString(This_XDisplay, This_XWindow, XWin->current_gc,
 			 (XWin->cursor_col) * XWin->font_width + b,
 			 (XWin->cursor_row) * XWin->font_height + b + XWin->font_base,
 			 s, n);
@@ -449,11 +502,28 @@
 	     gcv_mask = GCForeground | GCBackground;
 	     XChangeGC(This_XDisplay, gc, gcv_mask, &gcv);
 	  }
-	XDrawImageString(This_XDisplay, This_XWindow,
+#if XJED_XRENDERFONT
+	 if (XWin->face_size > 0)
+	 {
+	     if (!XWin->xftdraw)
+	     {
+		 XWin->xftdraw = XftDrawCreate(This_XDisplay, This_XWindow, DefaultVisual(This_XDisplay, This_XScreen), XWin->color_map);
+	     }
+	     XftDrawRect (XWin->xftdraw, Pixel2XftColor(gc_info->bg),
+			  (XWin->cursor_col) * XWin->font_width + b, (XWin->cursor_row) * XWin->font_height /*+ b + XWin->font_base*/,
+			  XWin->font_width, XWin->font_height);
+	     XftDrawString8(XWin->xftdraw, Pixel2XftColor(gc_info->fg), XWin->xftfont, (XWin->cursor_col) * XWin->font_width + b,
+			    (XWin->cursor_row) * XWin->font_height + b + XWin->font_base,
+			    &ch, 1);
+	 }
+	 else
+#endif	 
+        XDrawImageString(This_XDisplay, This_XWindow,
 			 gc,
 			 c * XWin->font_width + b,
 			 r * XWin->font_height + b + XWin->font_base,
 			 &ch, 1);
+	 
      }
    else
      {
@@ -469,6 +539,7 @@
 		       r * XWin->font_height + b,
 		       XWin->font_width - 1,
 		       XWin->font_height - 1);
+
      }
 
    XFlush(This_XDisplay);
@@ -605,6 +676,60 @@
 
 /*}}}*/
 
+
+#if XJED_XRENDERFONT
+XftColor *Pixel2XftColor(Pixel pixel)
+{
+#define CACHE_SIZE  4
+    static struct 
+    {
+	XftColor        color;
+	int             use;
+    }
+    cache[CACHE_SIZE];
+    static int      use;
+    int             i;
+    int             oldest, oldestuse;
+    XColor          color;
+    
+    oldestuse = 0x7fffffff;
+    oldest = 0;
+    for (i = 0; i < CACHE_SIZE; i++)
+    {
+	if (cache[i].use)
+        {	  
+	    
+	    if (cache[i].color.pixel == pixel)
+	    {
+		
+		cache[i].use = ++use;
+		return &cache[i].color;
+	    }
+	    
+	}
+	
+	if (cache[i].use < oldestuse)
+	{
+	    
+	    oldestuse = cache[i].use;
+	    oldest = i;
+	}
+	
+    }
+    
+    i = oldest;
+    color.pixel = pixel;
+    XQueryColor (This_XDisplay, XWin->color_map, &color);
+    cache[i].color.color.red = color.red;
+    cache[i].color.color.green = color.green;
+    cache[i].color.color.blue = color.blue;
+    cache[i].color.color.alpha = 0xffff;
+    cache[i].color.pixel = pixel;
+    cache[i].use = ++use;
+    return &cache[i].color;
+}
+#endif
+
 static void JX_reverse_index(int n) /*{{{*/
 {
    int r1, r2;
@@ -686,6 +811,10 @@
    if (XWin == NULL) return;
    Rev_Vid_Flag = color;
    XWin->current_gc = XWin->text_gc[color].gc;
+#if XJED_XRENDERFONT    
+   XWin->current_fg_pixel = XWin->text_gc[color].fg;
+   XWin->current_bg_pixel = XWin->text_gc[color].bg;
+#endif    
    vterm_reverse_video (color);
 }
 
@@ -1502,15 +1631,36 @@
 static int load_font (char *font) /*{{{*/
 {
    static XFontStruct *xfont;
+#if XJED_XRENDERFONT
+   if (XWin->face_size > 0)
+   {
+      /* the user wants xrender */
+      XWin->xftfont = XftFontOpen(This_XDisplay, This_XScreen, 
+				  XFT_FAMILY, XftTypeString, font, 
+				  XFT_SIZE, XftTypeDouble, XWin->face_size,
+				  XFT_SPACING, XftTypeInteger, XFT_MONO,
+				  0);
+      if (XWin->xftfont == NULL) return 0;
+      XWin->font_name = font;
+      XWin->font_height = XWin->xftfont->ascent + XWin->xftfont->descent;
+      XWin->font_width = XWin->xftfont->max_advance_width;
+      XWin->font_base = XWin->xftfont->ascent;
+   }
+   else 
+   {
+#endif       
+      xfont = XLoadQueryFont(This_XDisplay, font);
+      if (xfont == NULL) return 0;
+      XWin->font = xfont;
+      XWin->font_name = font;
+      XWin->font_height = XWin->font->ascent + XWin->font->descent;
+      XWin->font_width = XWin->font->max_bounds.width;
+      XWin->font_base = XWin->font->ascent;
+#if XJED_XRENDERFONT       
+   }
+#endif
 
-   xfont = XLoadQueryFont(This_XDisplay, font);
-   if (xfont == NULL) return 0;
 
-   XWin->font = xfont;
-   XWin->font_name = font;
-   XWin->font_height = XWin->font->ascent + XWin->font->descent;
-   XWin->font_width = XWin->font->max_bounds.width;
-   XWin->font_base = XWin->font->ascent;
    return 1;
 }
 
@@ -1761,15 +1911,28 @@
 {
    int i;
    XGCValues xgcv;
+#if XJED_XRENDERFONT
+   if (XWin->face_size == 0)
+#endif      
    xgcv.font = XWin->font->fid;
    for (i = 0; i < JMAX_COLORS; i++)
      {
 	xgcv.foreground = XWin->text_gc[i].fg;
 	xgcv.background = XWin->text_gc[i].bg;
-
-	XWin->text_gc[i].gc = XCreateGC(This_XDisplay, This_XWindow,
-					GCForeground | GCBackground | GCFont,
-					&xgcv);
+#if XJED_XRENDERFONT
+	if (XWin->face_size > 0)
+	{
+	   XWin->text_gc[i].gc = XCreateGC(This_XDisplay, This_XWindow,
+					   GCForeground | GCBackground /*| GCFont*/, /* XFT */
+					   &xgcv);
+	}
+	else
+#endif
+	   XWin->text_gc[i].gc = XCreateGC(This_XDisplay, This_XWindow,
+					   GCForeground | GCBackground | GCFont,
+					   &xgcv);
+	   
+	
      }
 }
 
@@ -1979,6 +2142,25 @@
 
    XWin->font_name = This_Font_Name;
 
+#if XJED_XRENDERFONT
+    /* if a parameter to -fs was supplied, we assume the user wants XFT */
+    if (strlen(This_Face_Size))
+    {
+	if ((XWin->face_size = atof(This_Face_Size))<=0)
+	{
+	    /* we couldn't convert the value, or a negative value was specified */
+	    XWin->face_size = 0;
+	}
+    }
+    else
+    {
+	/* there was no -fs, so we don't do nothing */
+	XWin->face_size = 0;
+    }
+    /* make sure that XWin->xftdraw is null in any case */
+    XWin->xftdraw = NULL;
+#endif
+
    This_XScreen = DefaultScreen(This_XDisplay);
 
    if (!load_font(XWin->font_name))
@@ -2006,8 +2188,13 @@
    create_needed_gcs ();		       /* This uses info from previous call */
 
    XWin->current_gc = XWin->text_gc[JNORMAL_COLOR].gc;
-
-   XSetFont (This_XDisplay, XWin->current_gc, XWin->font->fid);
+#if XJED_XRENDERFONT
+    XWin->current_fg_pixel = XWin->text_gc[JNORMAL_COLOR].fg;
+    XWin->current_bg_pixel = XWin->text_gc[JNORMAL_COLOR].bg;
+    /* we only XSetFont() if we're NOT using renderfont */
+    if (XWin->face_size == 0)
+#endif
+    XSetFont (This_XDisplay, XWin->current_gc, XWin->font->fid);
 
    /* display window */
 
@@ -2388,6 +2575,7 @@
    x_set_color_free (i, fg, bg, 1);
    XSetForeground(This_XDisplay, XWin->text_gc[i].gc, XWin->text_gc[i].fg);
    XSetBackground(This_XDisplay, XWin->text_gc[i].gc, XWin->text_gc[i].bg);
+
    if (i == JNORMAL_COLOR)
      XSetWindowBackground (This_XDisplay, This_XWindow, XWin->text_gc[i].bg);
 }
