[Qt-interest] Default application Font
Jon Flowers
Jon.Flowers at pgs.com
Fri Jan 30 12:57:53 CET 2009
I have copied the qtconfig config file (qt4 version) to the production
machine, added some debug code to verify that those settings are being
set and that all works. Now the issue is that the FONT is still a very
bad bitmap of some font and the only thing I can change is the point
size. I have verified via the QFontDatabase class that the font I am
using on my dev machine is on the production machine in the style and
size I want "Sans Serif Normal 9". This is the same on both machines,
but the non dev machine still shows a very jagged font that looks like
crap, and no matter what font I select in the ~/.config/Trolltech.conf
file I get a monospaced crap font that looks like I did it in paint bit
by bit. If I got a decent monospaced font I would leave it at that, but
the font selected looks like bad. I have screen grabs if that would
help.
So for some reason my application is not getting/honoring or
understanding what font to use. Now on the dev machine it uses the
correct font with no extra settings or problems.
Thanks for any and all help.
Jon
-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of
Oliver.Knoll at comit.ch
Sent: Thursday, January 29, 2009 4:18 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Default application Font
Jon Flowers wrote on Thursday, January 29, 2009 3:01 PM:
> ...
> Also looking at the preferences on that machine its default font is
> sans 10 and I am getting Helvetica 13 in my app. But I have
> overridden the font to sans serif and that seems to hold, but not the
> size.
Hmm, again I have to ask, which "preferences" are you referring to? Are
you running Gnome or KDE? If the later, then chances are pretty good
that Qt picks up the proper fonts (as set by KDE), if you do not
explicitly set them in your application. That is, chances are pretty
good that a call to:
http://doc.trolltech.com/4.4/qapplication.html#font
would return the same font (and size, off course) which you have set in
the "KDE font control panel". If on the other hand you are referring to
some "Gnome Preferences" then I don't know whether Qt will correctly
pick them up (especially if you have KDE and Gnome installed in
parallel).
In a related thread ("Russian fonts") the tool qtconfig-qt4 was
mentioned (which I think is Unix specific). It should probably tell you
what Qt takes as the "default font".
Alternatively you can try explicitly setting the desired font in your
app (instead of relying on some shaky system preferences):
int main(...)
{
// choose a "font family" which is really available on your system!
QApplication::setFont(QFont("Arial", 10));
QApplication app(...);
...
Font font = QApplication::font();
// 'font' should now refer to a "Arial, 10" font
}
That reminds me: I once had the problem that some older Linux distro did
not correctly detect my "Apple Cinema 21" display, and hence the screen
DPI settings were completely bogus (a "generic display" was assumed).
This resulted in the fonts being rendered too large in XEmacs ("pure
XLib based", I assume). AFAICR also Firefox was affected - notably a GTK
application ;)
Because obviously the underlying GTK/XLib/FreeType font
framework/renderer thought it would be nice to scale the fonts depending
on the DPI, so they appear at the same size on every screen (17", 20",
21", 24", ...). Once I had set the proper DPI the font appeared at
"normal" size.
So your previous statement "I have moved from the glade/gtk+ environment
and when a font gets set it is that way no matter the machine it gets
run on" has already been proven wrong by that ;) (because depending on
the user settings it can still appear at different sizes, even when you
request an "Arial, 10"). Ironically Qt applications were not affected by
the DPI settings...
Hope that helps,
Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
This email and any files contained therein is confidential and may contain privileged information. If you are not the named addressee(s) or you have otherwise received this in error, you should not distribute or copy this e-mail or use any of its content for any purpose. Please notify the sender immediately by e-mail if you have received this e-mail in error and delete it from your system
More information about the Qt-interest-old
mailing list