[Qt-interest] [Mac] Interesting/annoying multi-user font bug...
Dave Thorup
lists at kuwan.net
Mon Feb 23 22:39:26 CET 2009
I ran into an annoying multi-user font bug a little while back and
thought I'd share the details of it here in case anyone else gets
bitten by it. The problem is that if you install Qt or a Qt
application in one user account - say it's the main user account that
you use - then everything is fine, fonts are displayed properly.
However, if you then switch to a different user or create a new user
account and switch to it, then the application's fonts are messed up
in the other user account. The default Mac application font should be
Lucida Grande, however in the other user account when running a Qt
application the application font will be Helvetica instead, which
really stands out and looks bad. This can easily be observed by
running the Qt Assistant application in your main user account and
then running it in a new user account.
I was able to track down why this is happening but I don't know if
it's Apple's bug or Qt's. The reason why it happens is that for
whatever reason the other user account does not contain a font named
"Lucida Grande" (as seen by the Qt application), instead it contains a
font named "Lucida Grande CE". So the Qt app can't find "Lucida
Grande" and loads Helvetica instead as the default app font. To work
around this annoying bug I do the following before creating our
QApplication:
--------------------------------------------
QFontDatabase fontDb;
QStringList lst = fontDb.families();
if ( lst.contains( "Lucida Grande", Qt::CaseInsensitive ) )
QApplication::setFont( QFont( "Lucida Grande", 13 ) );
else if ( lst.contains( "Lucida Grande CE", Qt::CaseInsensitive ) )
QApplication::setFont( QFont( "Lucida Grande CE", 13 ) );
--------------------------------------------
Does anyone have any ideas as to why this happens? If not, well
hopefully this will help other Mac Qt developers around this annoying
little bug.
Qt 4.4
Mac OS X 10.5.6
--
Dave Thorup
Software Engineer
http://bibblelabs.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090223/82757412/attachment.html
More information about the Qt-interest-old
mailing list