PDA

View Full Version : Qt renders wrong font



durbrak
29th October 2006, 10:13
Hello,
I happened to notice that Qt behaves slightly different than it's supposed to. I'm using Qt 4.2.1 on Windows XP SP2.
If I use the standard Blue Luna theme on Windows XP Qt's font rendering looks exactly like it should. However, if I change to a custom theme where the theme uses a anti-aliased font Qt still uses the old standard pixel font, even though all my programs on Windows (Firefox, Thunderbird, Nero, Internet Explorer, Windows Explorer etc.) display the new smooth font.

Here's a screenshot from the Windows Explorer (top: Blue Luna; bottom: Custom Skin with smooth font)
http://img155.imageshack.us/img155/3152/viewbg9.png

Qt displays it still like this:
http://img88.imageshack.us/img88/1971/asoz4.png

However, Qt manages to display all QMenu(s) and QMessageBox(es) with the new smooth font (screenshot taken from the about box of Qt Assistant):
http://img247.imageshack.us/img247/1720/aboutxx5.png

So, when I switch to the custom theme, Firefox and all my other Windows programs use this new smooth font in every single control (treeviews, listviews, buttons, tabs, labels... just everything) but Qt still sticks to the old clumsy font.

How to avoid this behavior or is there any workaround?
Is this even a bug, because Qt seems to display QMenu and QMessageBox (but not QDialog) with the right font but the rest is just the old aliased font?

Thank you guys in advance.

wysota
29th October 2006, 10:18
What happens if you change the default font in qtconfig to a one that should be antialiased?

durbrak
29th October 2006, 10:47
I guess I'm kinda blind or something... but I just can't find the qtconfig tool anywhere I even did a search for it but nothing came up? All I found was the proper qtconfig html-file from the documentation...

durbrak
29th October 2006, 10:57
Anyways, I just looked up the font that is being used by the Windows Theme and its size and I put this in my main-function:


QFont font("Segoe UI");
font.setPixelSize(11);
QApplication::setFont(font);

Now everything looks just like it supposed to in my application, but that can't be the solution ;)

wysota
29th October 2006, 11:00
Maybe Windows version doesn't have qtconfig, I don't know. The actual problem is that the default font of your Qt installation is set to a font which is fine for one theme but is not updated when you switch teams. It might even be a limitation of Qt itself, you might want to report a suggestion to the Trolls to make it possible to switch default fonts automatically to comply to the theme used.

durbrak
29th October 2006, 11:50
I created a new task at trolltech.com
Let's see if anything changes. But I definitely think this is a bug :)

wysota
29th October 2006, 12:33
I don't think it is a bug. Maybe a lack of feature but not a bug. You can always subclass QApplication and set the font yourself based on what your system settings are.

durbrak
2nd November 2006, 13:41
The trolls added my task to their task tracker:

Task ID: 136762 (http://www.trolltech.com/developer/task-tracker/index_html?method=entry&id=136762)

So, what happens now? Do I have to look at that task entry a few times for a couple of weeks or does anything happen in general at all?

jpn
2nd November 2006, 14:36
Do you mean like if there's any further actions required by you? No. The time it takes to fix the bug of course depends on how urgent the bug is considered by the Trolls.