diff -uNr libXft-2.1.14-orig/src/xftfreetype.c libXft-2.1.14/src/xftfreetype.c
--- libXft-2.1.14-orig/src/xftfreetype.c	2009-01-30 00:19:09.000000000 +0100
+++ libXft-2.1.14/src/xftfreetype.c	2009-10-23 00:31:07.688061451 +0200
@@ -584,38 +584,43 @@
     {
 #ifdef FC_HINT_STYLE
 #ifdef FT_LOAD_TARGET_LIGHT
-	if (FC_HINT_NONE < hint_style && hint_style < FC_HINT_FULL)
-	{
-	    fi->load_flags |= FT_LOAD_TARGET_LIGHT;
-	}
-	else
-#endif
-#endif
-	{
-	    /* autohinter will snap stems to integer widths, when
-	     * the LCD targets are used.
-	     */
-	    switch (fi->rgba) {
-	    case FC_RGBA_RGB:
-	    case FC_RGBA_BGR:
-#ifdef FT_LOAD_TARGET_LCD
-		fi->load_flags |= FT_LOAD_TARGET_LCD;
+        switch ( hint_style )
+        {
+        case FC_HINT_SLIGHT:
+            fi->load_flags |= FT_LOAD_TARGET_LIGHT;
+            break;
+
+        case FC_HINT_FULL:
+            switch (fi->rgba) {
+            case FC_RGBA_RGB:
+            case FC_RGBA_BGR:
+                fi->load_flags |= FT_LOAD_TARGET_LCD;
+                break;
+            case FC_RGBA_VRGB:
+            case FC_RGBA_VBGR:
+                fi->load_flags |= FT_LOAD_TARGET_LCD_V;
+                break;
+
+            default:
+                ;
+            }
+            break;
+
+        default:  /* FC_HINT_MEDIUM */
+            ; /* nothing => FT_LOAD_TARGET_NORMAL */
+        }
+#endif  /* if FT_LOAD_TARGET_LIGHT isn't defined, you
+         * have a *very* old version of FreeType that
+         * doesn't support playing with the hinting
+         * algorithm, nothing to do then...
+         */
 #endif
-		break;
-	    case FC_RGBA_VRGB:
-	    case FC_RGBA_VBGR:
-#ifdef FT_LOAD_TARGET_LCD_V
-		fi->load_flags |= FT_LOAD_TARGET_LCD_V;
-#endif
-		break;
-	    }
-	}
     }
 #ifdef FT_LOAD_TARGET_MONO
     else
 	fi->load_flags |= FT_LOAD_TARGET_MONO;
 #endif
-    
+
     /* set vertical layout if requested */
     switch (FcPatternGetBool (pattern, FC_VERTICAL_LAYOUT, 0, &vertical_layout)) {
     case FcResultNoMatch:
diff -uNr libXft-2.1.14-orig/src/xftglyphs.c libXft-2.1.14/src/xftglyphs.c
--- libXft-2.1.14-orig/src/xftglyphs.c	2009-01-30 00:19:09.000000000 +0100
+++ libXft-2.1.14/src/xftglyphs.c	2009-10-23 00:31:07.688061451 +0200
@@ -27,6 +27,17 @@
 #include <freetype/ftsynth.h>
 #endif
 
+/* define the following macro if you want to use a small FIR filter to
+ * reduce color fringes for LCD rendering. If undefined, the original
+ * weird pixel-local color balancing algorithm will be used
+ */
+#define  FIR_FILTER
+  
+#ifdef FIR_FILTER
+/* note: keep the filter symetric, or bad things will happen */
+static const int   fir_filter[5] = { 0x10, 0x40, 0x70, 0x40, 0x10 };
+
+#else /* !FIR_FILTER */
 static const int    filters[3][3] = {
     /* red */
 #if 0
@@ -42,6 +53,7 @@
     /* blue */
 {    65538*1/13,65538*3/13,65538*9/13 },
 };
+#endif /* !FIR_FILTER */
 
 /*
  * Validate the memory info for a font
@@ -133,6 +145,10 @@
 
     while (nglyph--)
     {
+#ifdef FIR_FILTER    
+        int  margin_top = 0, margin_left = 0;
+#endif
+        
 	glyphindex = *glyphs++;
 	xftg = font->glyphs[glyphindex];
 	if (!xftg)
@@ -171,6 +187,17 @@
 		
 	glyphslot = face->glyph;
 
+        if (font->info.embolden &&
+            glyphslot->format == ft_glyph_format_outline &&
+            glyphslot->outline.n_points &&
+            pub->height <= 18 &&
+	    !font->info.antialias && 
+	    !(font->info.load_flags & FT_LOAD_NO_HINTING)) {
+	    error = FT_Render_Glyph (glyphslot, FT_RENDER_MODE_MONO);
+            if (error)
+                continue;
+        }
+            
 #if HAVE_FT_GLYPHSLOT_EMBOLDEN
 	/*
 	 * Embolden if required
@@ -181,7 +208,7 @@
 	/*
 	 * Compute glyph metrics from FreeType information
 	 */
-	if(font->info.transform && glyphslot->format != ft_glyph_format_bitmap) 
+	if(font->info.transform && glyphslot->format != FT_GLYPH_FORMAT_BITMAP) 
 	{
 	    /*
 	     * calculate the true width by transforming all four corners.
@@ -260,12 +287,41 @@
 	    }
 	}
 
-	if (font->info.antialias)
-	    pitch = (width * hmul + 3) & ~3;
-	else
-	    pitch = ((width + 31) & ~31) >> 3;
-
-	size = pitch * height * vmul;
+	/* now we're going to adjust the margins of the glyph for LCD filtering */
+        if (font->info.antialias) {
+	    switch (font->info.rgba) {
+	    case FC_RGBA_RGB:
+	    case FC_RGBA_BGR:
+#ifdef FIR_FILTER            
+                margin_left = 1;
+                left       -= 64;
+                right      += 64;
+                width      += 2;
+#endif /* FIR_FILTER */                
+                pitch       = (width*3+3) & ~3;
+                size        = pitch*height;
+                break;
+                
+            case FC_RGBA_VRGB:
+            case FC_RGBA_VBGR:
+#ifdef FIR_FILTER                
+                margin_top = 0;
+                top       += 64;
+                bottom    -= 64;
+                height    += 2;
+#endif /* FIR_FILTER */                
+                pitch      = (width+3) & ~3;
+                size       = pitch*height*3;
+                break;
+            
+            default:
+               pitch = (width+3) & ~3;
+               size  = pitch*height;
+	    }
+	} else {
+	    pitch = ((width+31) & ~31) >> 3;
+            size  = pitch*height;
+	}
 
 	xftg->metrics.width = width;
 	xftg->metrics.height = height;
@@ -325,8 +381,10 @@
 	    if (bufBitmap != bufLocal)
 		free (bufBitmap);
 	    bufBitmap = (unsigned char *) malloc (size);
-	    if (!bufBitmap)
+	    if (!bufBitmap) {
+                bufBitmap = bufLocal;  /* prevent free(NULL) later !! */
 		continue;
+            }
 	    bufSize = size;
 	}
 	memset (bufBitmap, 0, size);
@@ -335,7 +393,7 @@
 	 * Rasterize into the local buffer
 	 */
 	switch (glyphslot->format) {
-	case ft_glyph_format_outline:
+	case FT_GLYPH_FORMAT_OUTLINE:
 	    ftbit.width      = width * hmul;
 	    ftbit.rows       = height * vmul;
 	    ftbit.pitch      = pitch;
@@ -353,35 +411,50 @@
 
 	    FT_Outline_Get_Bitmap( _XftFTlibrary, &glyphslot->outline, &ftbit );
 	    break;
-	case ft_glyph_format_bitmap:
+	case FT_GLYPH_FORMAT_BITMAP:
 	    if (font->info.antialias)
 	    {
 		unsigned char	*srcLine, *dstLine;
 		int		height;
+                int             width = glyphslot->bitmap.width;
 		int		x;
-		int	    h, v;
 
 		srcLine = glyphslot->bitmap.buffer;
-		dstLine = bufBitmap;
+		dstLine = bufBitmap + margin_left + margin_top*pitch;
 		height = glyphslot->bitmap.rows;
 		while (height--)
 		{
-		    for (x = 0; x < glyphslot->bitmap.width; x++)
+                    unsigned char*  src  = srcLine;
+                    unsigned char*  dst  = dstLine;
+                    unsigned int    mask = 0x8080;
+                    
+		    for (x = 0; x < width; x++ )
 		    {
-			/* always MSB bitmaps */
-			unsigned char	a = ((srcLine[x >> 3] & (0x80 >> (x & 7))) ?
-					     0xff : 0x00);
-			if (subpixel)
-			{
-			    for (v = 0; v < vmul; v++)
-				for (h = 0; h < hmul; h++)
-				    dstLine[v * pitch + x*hmul + h] = a;
-			}
-			else
-			    dstLine[x] = a;
-		    }
-		    dstLine += pitch * vmul;
-		    srcLine += glyphslot->bitmap.pitch;
+                        if ( (src[0] & mask) != 0 ) {
+                            dst[0] = 0xFF;
+                            if ( hmul == 3 ) {
+                                dst[1] = 0xFF;
+                                dst[2] = 0xFF;
+                            }
+                        }
+
+                        mask >>= 1;
+                        if ( (mask & 0x80) != 0 ) {
+                            mask = 0x8080;
+                            src += 1;
+                        }
+                    }
+
+                    if ( vmul == 3 ) {
+                        memcpy( dstLine + pitch, dstLine, width*3 );
+                        dstLine += pitch;
+
+                        memcpy( dstLine + pitch, dstLine, width*3 );
+                        dstLine += pitch;
+                    }
+		    
+                    dstLine += pitch;
+		    srcLine += width;
 		}
 	    }
 	    else
@@ -457,74 +530,270 @@
 
 	if (subpixel)
 	{
-	    int		    x, y;
-	    unsigned char   *in_line, *out_line, *in;
-	    unsigned int    *out;
-	    unsigned int    red, green, blue;
-	    int		    rf, gf, bf;
-	    int		    s;
-	    int		    o, os;
-	    
-	    /*
-	     * Filter the glyph to soften the color fringes
-	     */
-	    widthrgba = width;
-	    pitchrgba = (widthrgba * 4 + 3) & ~3;
-	    sizergba = pitchrgba * height;
-
-	    os = 1;
-	    switch (font->info.rgba) {
-	    case FC_RGBA_VRGB:
-		os = pitch;
-	    case FC_RGBA_RGB:
-	    default:
-		rf = 0;
-		gf = 1;
-		bf = 2;
-		break;
-	    case FC_RGBA_VBGR:
-		os = pitch;
-	    case FC_RGBA_BGR:
-		bf = 0;
-		gf = 1;
-		rf = 2;
-		break;
-	    }
-	    if (sizergba > bufSizeRgba)
-	    {
-		if (bufBitmapRgba != bufLocalRgba)
-		    free (bufBitmapRgba);
-		bufBitmapRgba = (unsigned char *) malloc (sizergba);
-		if (!bufBitmapRgba)
-		    continue;
-		bufSizeRgba = sizergba;
-	    }
-	    memset (bufBitmapRgba, 0, sizergba);
-	    in_line = bufBitmap;
-	    out_line = bufBitmapRgba;
-	    for (y = 0; y < height; y++)
-	    {
-		in = in_line;
-		out = (unsigned int *) out_line;
-		in_line += pitch * vmul;
-		out_line += pitchrgba;
-		for (x = 0; x < width * hmul; x += hmul)
-		{
-		    red = green = blue = 0;
-		    o = 0;
-		    for (s = 0; s < 3; s++)
-		    {
-			red += filters[rf][s]*in[x+o];
-			green += filters[gf][s]*in[x+o];
-			blue += filters[bf][s]*in[x+o];
-			o += os;
-		    }
-		    red = red / 65536;
-		    green = green / 65536;
-		    blue = blue / 65536;
-		    *out++ = (green << 24) | (red << 16) | (green << 8) | blue;
-		}
-	    }
+            widthrgba = width;
+            pitchrgba = (widthrgba * 4 + 3) & ~3;
+            sizergba = pitchrgba * height;
+
+            if (sizergba > bufSizeRgba)
+            {
+                if (bufBitmapRgba != bufLocalRgba)
+                    free (bufBitmapRgba);
+                bufBitmapRgba = (unsigned char *) malloc (sizergba);
+                if (!bufBitmapRgba) {
+                    bufBitmapRgba = bufLocalRgba;  /* prevent free(NULL) later !! */
+                    continue;
+                }
+                bufSizeRgba = sizergba;
+            }
+            memset (bufBitmapRgba, 0, sizergba);
+
+#ifdef FIR_FILTER
+            {
+                unsigned char*  line;
+
+               /* perform in-place FIR filtering in either the horizontal or
+                * vertical direction
+                */
+                switch (font->info.rgba) {
+                case FC_RGBA_RGB:
+                case FC_RGBA_BGR:
+                    {
+                        int  h;
+
+                        line = bufBitmap;
+                        for ( h = height; h > 0; h--, line += pitch ) {
+                            int             pix[6] = { 0, 0, 0, 0, 0, 0 };
+                            unsigned char*  p      = line;
+                            unsigned char*  limit  = line + width*3;
+                            int             nn, val, val2;
+
+                            val = p[0];
+                            for (nn = 0; nn < 3; nn++)
+                                pix[2+nn] += val*fir_filter[nn];
+
+                            val = p[1];
+                            for (nn = 0; nn < 4; nn++)
+                                pix[1+nn] += val*fir_filter[nn];
+
+                            p += 2;
+                            
+                            for ( ; p  < limit; p++ ) {
+                                val = p[0];
+                                for (nn = 0; nn < 5; nn++)
+                                    pix[nn] += val*fir_filter[nn];
+
+                                val2  = pix[0]/255;
+                                if (val2 > 255) val2 = 255;
+                                p[-2]  = (unsigned char)val2;
+
+                                for (nn = 0; nn < 5; nn++)
+                                    pix[nn] = pix[nn+1];
+                            }
+                            for (nn = 0; nn < 2; nn++ ) {
+                                val2 = pix[nn]/255;
+                                if (val2 > 255) val2 = 255;
+                                p[nn-2] = (unsigned char)val2;
+                            }
+                        }
+                    }
+                    break;
+                
+                case FC_RGBA_VRGB:
+                case FC_RGBA_VBGR:
+                    {
+                        int  w;
+
+                        for (w = 0; w < width; w++ ) {
+                            int  pix[6] = { 0, 0, 0, 0, 0, 0 };
+                            unsigned char*  p     = bufBitmap + w;
+                            unsigned char*  limit = bufBitmap + w + height*3*pitch;
+                            int             nn, val, val2;
+
+                            val = p[0];
+                            for (nn = 0; nn < 3; nn++)
+                                pix[2+nn] += val*fir_filter[nn];
+
+                            val = p[pitch];
+                            for (nn = 0; nn < 4; nn++ )
+                                pix[1+nn] += val*fir_filter[nn];
+
+                            p += 2*pitch;
+                            for ( ; p < limit; p += pitch ) {
+                                val = p[0];
+                                for (nn = 0; nn < 5; nn++ )
+                                    pix[nn] += val*fir_filter[nn];
+
+                                val2 = pix[0]/255;
+                                if (val2 > 255) val2 = 255;
+                                p[-2*pitch] = (unsigned char)val2;
+
+                                for (nn = 0; nn < 5; nn++)
+                                    pix[nn] = pix[nn+1];
+                            }
+
+                            for (nn = 0; nn < 2; nn++) {
+                                val2 = pix[nn]/255;
+                                if (val2 > 255) val2 = 255;
+                                p[(nn-2)*pitch] = (unsigned char)val2;
+                            }
+                        }
+                    }
+                    break;
+
+                default:
+                    ;
+                }
+
+                /* now copy the resulting RGB graymap into an ARGB map */
+                {
+                    unsigned char*  in_line  = bufBitmap;
+                    unsigned char*  out_line = bufBitmapRgba;
+                    int             h;
+
+                    switch (font->info.rgba) {
+                    case FC_RGBA_RGB:
+                        for (h = height; h > 0; h--) {
+                          unsigned char*  in  = in_line;
+                          int*            out = (int*)out_line;
+                          int             w;
+
+                          for (w = width; w > 0; w--, in += 3, out += 1) {
+                            int  r = in[0];
+                            int  g = in[1];
+                            int  b = in[2];
+                            
+                            out[0] = (g << 24) | (r << 16)  | (g << 8) | (b);
+                          }
+                          
+                          in_line  += pitch;
+                          out_line += pitchrgba;
+                        }
+                        break;
+                        
+                    case FC_RGBA_BGR:
+                        for (h = height; h > 0; h--) {
+                          unsigned char*  in  = in_line;
+                          int*            out = (int*)out_line;
+                          int             w;
+
+                          for (w = width; w > 0; w--, in += 3, out += 1) {
+                            int  r = in[0];
+                            int  g = in[1];
+                            int  b = in[2];
+                            
+                            out[0] = (g << 24) | (b << 16)  | (g << 8) | (r);
+                          }
+                          
+                          in_line  += pitch;
+                          out_line += pitchrgba;
+                        }
+                        break;
+                        
+                    case FC_RGBA_VRGB:
+                        for (h = height; h > 0; h--) {
+                          unsigned char*  in  = in_line;
+                          unsigned char*  out = out_line;
+                          int             w;
+
+                          for (w = width; w > 0; w--, in += 1, out += 4) {
+                            int  r = in[0*pitch];
+                            int  g = in[1*pitch];
+                            int  b = in[2*pitch];
+
+                            ((int*)out)[0] = (g << 24) | (r << 16)  | (g << 8) | (b);
+                          }
+                          
+                          in_line  += 3*pitch;
+                          out_line += pitchrgba;
+                        }
+                        break;
+                        
+                    case FC_RGBA_VBGR:
+                        for (h = height; h > 0; h--) {
+                          unsigned char*  in  = in_line;
+                          unsigned char*  out = out_line;
+                          int             w;
+
+                          for (w = width; w > 0; w--, in += 1, out += 4) {
+                            int  r = in[0*pitch];
+                            int  g = in[1*pitch];
+                            int  b = in[2*pitch];
+
+                            ((int*)out)[0] = (g << 24) | (b << 16)  | (g << 8) | (r);
+                          }
+                          
+                          in_line  += 3*pitch;
+                          out_line += pitchrgba;
+                        }
+                        break;
+                        
+                    default:
+                        ;
+                    }
+                }
+            }
+#else /* !FIR_FILTER */
+            {
+                int		    x, y;
+                unsigned char   *in_line, *out_line, *in;
+                unsigned int    *out;
+                unsigned int    red, green, blue;
+                int		    rf, gf, bf;
+                int		    s;
+                int		    o, os;
+                
+                /*
+                * Filter the glyph to soften the color fringes
+                */
+                widthrgba = width;
+                pitchrgba = (widthrgba * 4 + 3) & ~3;
+                sizergba = pitchrgba * height;
+    
+                os = 1;
+                switch (font->info.rgba) {
+                case FC_RGBA_VRGB:
+                    os = pitch;
+                case FC_RGBA_RGB:
+                default:
+                    rf = 0;
+                    gf = 1;
+                    bf = 2;
+                    break;
+                case FC_RGBA_VBGR:
+                    os = pitch;
+                case FC_RGBA_BGR:
+                    bf = 0;
+                    gf = 1;
+                    rf = 2;
+                    break;
+                }
+                in_line = bufBitmap;
+                out_line = bufBitmapRgba;
+                for (y = 0; y < height; y++)
+                {
+                    in = in_line;
+                    out = (unsigned int *) out_line;
+                    in_line += pitch * vmul;
+                    out_line += pitchrgba;
+                    for (x = 0; x < width * hmul; x += hmul)
+                    {
+                        red = green = blue = 0;
+                        o = 0;
+                        for (s = 0; s < 3; s++)
+                        {
+                            red += filters[rf][s]*in[x+o];
+                            green += filters[gf][s]*in[x+o];
+                            blue += filters[bf][s]*in[x+o];
+                            o += os;
+                        }
+                        red = red / 65536;
+                        green = green / 65536;
+                        blue = blue / 65536;
+                        *out++ = (green << 24) | (red << 16) | (green << 8) | blue;
+                    }
+                }
+            }
+#endif /* !FIR_FILTER */
 	    
 	    xftg->glyph_memory = sizergba + sizeof (XftGlyph);
 	    if (font->format)
