[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#448555: Patch against deliberate font-uglification by Qt



Hello,

as the first mail has no linebreaks (sorry for that), I repeat the
message (edited):

> Qt-4.5.0 still is deliberately convoluting the glyphs generated by
> libfreetype with a triangel-filter, bluring the glyphs and
> generating colored fringes at stems. (Examples can be seen at
> http://www.forwiss.uni-passau.de/~berberic/QT3-4-font.png and with
> 400% magnification at
> http://www.forwiss.uni-passau.de/~berberic/QT3-4-font-400.png)
> 
> This not only makes fonts blury – especially on low resolution
> display – but also has the effect of making mixed toolkit
> environments (which is quite normal with X11) patchy, because Qt4-
> and KDE-4-applications will look “different”. And of course it's
> definitely not the job of a toolkit to botch around with glyphs
> generated by the font-subsystem (here: libfreetype).
> 
> As Trolltech/Nokia obstinately refuses to fix this problem for ages
> (see
> http://www.qtsoftware.com/developer/task-tracker/index_html?method=entry&id=195256%3E?)
> the only way to get decent glyph-rendering in Debian is to fix this
> by patch.

A patch that removes glyph blurrying is attached. It works fine here.

	MfG
	bmg

-- 
„Des is völlig wurscht, was heut beschlos- | M G Berberich
 sen wird: I bin sowieso dagegn!“          | berberic@fmi.uni-passau.de
(SPD-Stadtrat Kurt Schindler; Regensburg)  | www.fmi.uni-passau.de/~berberic
--- qt4-x11-4.5.0-orig/src/gui/text/qfontengine_ft.cpp	2009-02-25 22:09:23.000000000 +0100
+++ qt4-x11-4.5.0/src/gui/text/qfontengine_ft.cpp	2009-03-15 15:37:18.000000000 +0100
@@ -575,26 +575,6 @@
     }
 }
 
-static void convoluteBitmap(const uchar *src, uchar *dst, int width, int height, int pitch)
-{
-    // convolute the bitmap with a triangle filter to get rid of color fringes
-    // If we take account for a gamma value of 2, we end up with
-    // weights of 1, 4, 9, 4, 1. We use an approximation of 1, 3, 8, 3, 1 here,
-    // as this nicely sums up to 16 :)
-    int h = height;
-    while (h--) {
-        dst[0] = dst[1] = 0;
-        //
-        for (int x = 2; x < width - 2; ++x) {
-            uint sum = src[x-2] + 3*src[x-1] + 8*src[x] + 3*src[x+1] + src[x+2];
-            dst[x] = (uchar) (sum >> 4);
-        }
-        dst[width - 2] = dst[width - 1] = 0;
-        src += pitch;
-        dst += pitch;
-    }
-}
-
 QFontEngineFT::QFontEngineFT(const QFontDef &fd)
 {
     fontDef = fd;
@@ -1041,10 +1021,7 @@
         if (hsubpixel) {
             Q_ASSERT (bitmap.pixel_mode == FT_PIXEL_MODE_GRAY);
             Q_ASSERT(antialias);
-            uchar *convoluted = new uchar[bitmap.rows*bitmap.pitch];
-            convoluteBitmap(bitmap.buffer, convoluted, bitmap.width, info.height, bitmap.pitch);
-            convertRGBToARGB(convoluted + 1, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB);
-            delete [] convoluted;
+            convertRGBToARGB(bitmap.buffer + 1, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB);
         } else if (vfactor != 1) {
             convertRGBToARGB_V(bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_VRGB);
         }

Reply to: