[Qt-interest] Bad default font rendering in vista 64bit
Jonathan Kew
jonathan_kew at sil.org
Sun Apr 5 16:06:12 CEST 2009
On 5 Apr 2009, at 08:10, spam wrote:
> I am using Qt 4.5.0 compiled on windows vista 64bit. The default font
> for my windows is Segoe UI 8pt.
> So Qt is using this font by default. The problem is that it is
> rendering
> that font very badly. It looks fine
> in all the other windows applications that use it. Here is a
> screenshot
> of what it looks like:
> http://img27.imageshack.us/img27/1170/qtbadfont.png
>
> Pay close attention to the letter 'B' in this image:
> http://img27.imageshack.us/img27/483/qtbadfont2.png
>
> Obviously I can get around this by doing a QApplication::setFont,
> but I
> was wondering if there was a way
> to either tell Qt to use a different default font for all my
> applications, or to fix this problem.
I haven't looked at the actual Qt code involved, but from the images,
it seems as if each glyph is being clipped to the bounding box
returned by the Windows GDI function GetGlyphOutline. Unfortunately,
the metrics returned by GetGlyphOutline refer to the original outline
of the glyph, and *not* to the pixels that will actually be touched
when the glyph is painted, especially when ClearType is enabled (which
tends to make glyphs "bleed" into pixels beyond their nominal outline).
As far as I know, there is no Windows API to determine the actual
bounds of the pixels that will be touched in order to paint the
glyphs, so the only workaround is to avoid such clipping, or to add a
couple of pixels of "safety margin" around the bounds returned by
GetGlyphOutline. Of course, certain font/size combinations suffer much
more than others, depending how the process of grid-fitting and/or
antialiasing happens to work out. Tahoma at 11-pixel size is another
particularly problematic case.
Of course, if it turns out that Qt's glyph-painting operations are not
using any such clipping, I could be completely off-base here. But I've
seen very similar-looking problems in other software, and this was the
root of the issue in that case.
JK
More information about the Qt-interest-old
mailing list