Bug#448555: fixed in qt4-x11 4.5.0-2
Armin Berres wrote: On Tue, 17 Mar 09 10:26, Tomáš Janoušek wrote: Hello, On Tue, Mar 17, 2009 at 12:21:11AM +, Fathi Boudra wrote: - 0278-X11-Use-legacy-LCD-filtering-if-specified-in-font-c.diff If Freetype is built without subpixel rendering, we should use the Qt 3 intrapixel filter instead of the bitmap convolution when the Legacy LCD filter is chosen. (Closes: #448555) It uses the old hinting mechanism and looks somewhat better, but subpixel rendering is off. This is still worse than qt3. http://store.lisk.in/tmp/2009-03-17-102510_1280x800_scrot.png (left - qt3, right - qt4) It is even a bit worse here. The general appearence of the font is nice, but the fringing is not. See http://alioth.debian.org/~trigger-guest/color-fringing-with-qt4.5-2.png and http://alioth.debian.org/~trigger-guest/color-fringing2-with-qt4.5-2.png Compared to what we have now I like blurred fonts we had with -1 much better. Greetings, Armin PS: No need to CC me. Just in case anyone wonders... Are you sure that's related to this patch? Qt also added some patches in 4.5 to more closely respect the Fontconfig hinting settings. Could you try switching between Slight, Medium, and Full hinting in your Appearance settings? Previous to 4.5 Qt would always do full hinting if subpixel antialiasing was enabled. Regards, Samuel -- To UNSUBSCRIBE, email to debian-qt-kde-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#448555: fixed in qt4-x11 4.5.0-2
M G Berberich wrote: I don't know what the patch should do and where the problem lies, but on two Debian machines I tested the qt 4.5.0-2 packages effectivly disable subpixel-rendering. This looks much better than the uglified glyphs from 4.5.0-1 but still is not the desired result. I'm assume there is (still) a bug in the patch, probably somewhere around the call to convertRGBToARGB and the legacyFilter boolean. Could you try manually reverting the patch to see if the problem still exists? Alternatively you could comment out this line: useLegacyLcdFilter = (lcdFilterType == FT_LCD_FILTER_LEGACY); which should make the patch void as it should always use the old convoluteBitmap() approach. Assumption: perhaps we here have three different libraries trying to work around FT_CONFIG_OPTION_SUBPIXEL_RENDERING = false, namely GTK/pango, kde3 and kde4, and in the past it worked because they all did something similar. Yes, it's a pity that each toolkit tries to do subpixel rendering in its own way at the moment. Though even on Ubuntu (which enables FT_CONFIG_OPTION_SUBPIXEL_RENDERING by default) there are differences between Qt and GTK's font rendering. I assume it's because of different interpretations of the Fontconfig settings (GTK seems to switch legacy LCD filtering off when full hinting is enabled). Cheers, Samuel -- To UNSUBSCRIBE, email to debian-qt-kde-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#448555: fixed in qt4-x11 4.5.0-2
Tomáš: It uses the old hinting mechanism and looks somewhat better, but subpixel rendering is off. This is still worse than qt3. Did you apply the patch cleanly against Qt 4.5? The patch doesn't enable or disable subpixel rendering, it simply switches between a Qt 3 style intrapixel and Qt 4 interpixel filter. bmg: In Debian in libfreetype, FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not set, probably on purpose. The libfreetype doku says: Note that no filter is active by default, and that this function is not implemented in default builds of the library. You need to #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your ‘ftoption.h’ file in order to activate it. So no filter is applied by libfreetype and Qt should honor this and _not_ _blur_ _glyphs_. This not only makes fonts ugly on low resolution devices but also make the desktop inconsistent, because Qt3, KDE3 and GTK-Applications will look fine while Qt4-Applications will look “different”. In my opinion a toolkit should not mess with libfreetypes glyph-rendering. This is wrong, if FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not set libfreetype does _not_ do subpixel rendering. Qt actually emulates subpixel rendering in that case by rendering into a mask that's three times as wide (as I mentioned earlier). A filter was used in the Qt 3 days also, however the filter was changed in Qt 4 to match the new recommended Freetype filters. By saying a toolkit should not mess with libfreetypes glyph-rendering I guess you'd prefer if Qt didn't do subpixel rendering at all if it wasn't enabled in libfreetype? Then your complaints about the default LCD filter would be void. If you enable FT_CONFIG_OPTION_SUBPIXEL_RENDERING you'll get the exact rendering that Fontconfig and Freetype specify. Without it, Qt tries to do a best effort (and with the fix to 248387 which will be in 4.5.1 we also try to emulate the legacy LCD filter more closely). Please refer to the left-most column of http://www.spasche.net/files/lcdfiltering/ to see how bad certain fonts look without any kind of LCD filtering. A lot of people actually prefer the smoothed look of the default filtered fonts, which is closer to how the Mac does font rendering. It's definitely not in Qt's place to force people to use unfiltered fonts. If you dislike Freetype's default filtering (which our default filter emulates pretty closely) I think you should take this up with Debian and Freetype, not with us. Debian is free to make the default Fontconfig setup enable Legacy LCD filtering, however I don't think it's a good idea as it severly decreases the rendering quality for certain fonts. If anything it should be a per-font setting. Cheers, Samuel -- To UNSUBSCRIBE, email to debian-qt-kde-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#448555: fonts are not hinted, therefore blurry and ugly
Hello, the proposed patch is not ideal, as it ignores the Fontconfig LCD filter settings and produces quite severe color fringes for many fonts. First, this is not a hinting issue, but an LCD filtering issue. For Qt to honor the Fontconfig filtering settings in 4.5.0 it needed Freetype to be built with subpixel rendering support. In that case Freetype does all the font rendering and filtering and Qt is only used to display the fonts in the end. However, if Freetype is not built with subpixel rendering support Qt does subpixel rendering by using Freetype's gray antialiasing into a mask that's three times wider than the width of the glyph, and applying a smoothing filter on the resulting mask. The proposed patch simply disables the smoothing filter which causes severe color fringes on certain fonts (especially visible with FreeSans or FreeSerif). The correct solution when Freetype is built without subpixel antialiasing support is to fall back to the Qt 3 intrapixel LCD filter instead of the Qt 4 smoothing filter when the legacy LCD filter setting is specified in Fontconfig. This will be fixed in Qt 4.5.1 (ref http://www.qtsoftware.com/developer/task-tracker/index_html?method=entryid=248387). The following comparison page shows the differences between no LCD filtering (as per the proposed patch), default LCD filtering (close to Qt 4's smoothing filter), and legacy LCD filtering (close to Qt 3's intrapixel filter): http://www.spasche.net/files/lcdfiltering/ In conclusion I hope you do not include the proposed patch in Debian or in qt-copy :) Cheers, Samuel Rødal -- To UNSUBSCRIBE, email to debian-qt-kde-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#448555: fonts are not hinted, therefore blurry and ugly
Fathi Boudra wrote: Hi, This will be fixed in Qt 4.5.1 (ref http://www.qtsoftware.com/developer/task-tracker/index_html?method=entryid=248387). In conclusion I hope you do not include the proposed patch in Debian or in qt-copy :) thanks for your reply. Qt snapshots aren't updated since 2-3 weeks. Is it possible to get the patch now and apply it to qt-copy ? cheers, Fathi Sure, I've attached the patch to this mail. Note that to enable the legacy LCD filtering you need to edit your fonts.conf settings (http://fontconfig.org/fontconfig-user.html). It should contain the snippet mentioned in this qt-interest post: http://article.gmane.org/gmane.comp.lib.qt.general/11465 There is currently a bug in Cairo that causes it to use Legacy LCD filtering by default (ref the discussion at http://bugs.freedesktop.org/show_bug.cgi?id=10301). Thus, if you want Qt applications to look like GTK applications you need to manually set the LCD filtering method to Legacy as described in the qt-interest post above. Cheers, Samuel From b7f4094bcb9eccfb14c5b1f1e6502a4b11c78047 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Samuel=20R=C3=B8dal?= sroe...@trolltech.com Date: Mon, 16 Mar 2009 14:26:22 +0100 Subject: [PATCH] X11: Use legacy LCD filtering if specified in font config. If Freetype is built without subpixel rendering, we should use the Qt 3 intrapixel filter instead of the bitmap convolution when the Legacy LCD filter is chosen. Task-number: 248387 Reviewed-by: Jens --- src/gui/text/qfontengine_ft.cpp | 28 ++-- 1 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 264d8de..f2389e3 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -529,7 +529,7 @@ static const uint subpixel_filter[3][3] = { }; #endif -static void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr) +static void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, int src_pitch, bool bgr, bool legacyFilter) { int h = height; const int offs = bgr ? -1 : 1; @@ -540,8 +540,16 @@ static void convertRGBToARGB(const uchar *src, uint *dst, int width, int height, uint red = src[x+1-offs]; uint green = src[x+1]; uint blue = src[x+1+offs]; -uint alpha = green; -uint res = (alpha 24) + (red 16) + (green 8) + blue; +uint res; +#if !defined(QT_USE_FREETYPE_LCDFILTER) +if (legacyFilter) { +uint high = (red*subpixel_filter[0][0] + green*subpixel_filter[0][1] + blue*subpixel_filter[0][2]) 8; +uint mid = (red*subpixel_filter[1][0] + green*subpixel_filter[1][1] + blue*subpixel_filter[1][2]) 8; +uint low = (red*subpixel_filter[2][0] + green*subpixel_filter[2][1] + blue*subpixel_filter[2][2]) 8; +res = (mid 24) + (high 16) + (mid 8) + low; +} else +#endif +res = (green 24) + (red 16) + (green 8) + blue; *dd = res; ++dd; } @@ -941,7 +949,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, Glyph glyph_buffer = new uchar[glyph_buffer_size]; if (hsubpixel) -convertRGBToARGB(slot-bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot-bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB); +convertRGBToARGB(slot-bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot-bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB, false); else if (vfactor != 1) convertRGBToARGB_V(slot-bitmap.buffer, (uint *)glyph_buffer, info.width, info.height, slot-bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_VRGB); } else @@ -1042,8 +1050,16 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, Glyph 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); +bool useLegacyLcdFilter = false; +#if defined(FT_LCD_FILTER_H) +useLegacyLcdFilter = (lcdFilterType == FT_LCD_FILTER_LEGACY); +#endif +uchar *buffer = bitmap.buffer; +if (!useLegacyLcdFilter) { +convoluteBitmap(bitmap.buffer, convoluted, bitmap.width, info.height, bitmap.pitch); +buffer = convoluted; +} +convertRGBToARGB(buffer + 1, (uint *)glyph_buffer, info.width, info.height, bitmap.pitch, subpixelType != QFontEngineFT::Subpixel_RGB, useLegacyLcdFilter); delete []