[Qt-interest] QPainter.drawText uses wrong font on my Mac

Kustaa Nyholm Kustaa.Nyholm at planmeca.com
Tue Sep 7 14:47:15 CEST 2010


Hi,

a strange problem.

All the fonts in this project I'm working with are drawn with wrong glyphs.

The font in question is MyriadPro and it is not installed in my system (Mac
OS X) but we add to the font database with:

err=QFontDatabase::addApplicationFont("MyriadPro-Regular.otf");

and I've done:

    QFontDatabase fdb;
    foreach (QString f , fdb.families()) {
        qDebug() << f;
    }

to verify that the font is available for my application.

In the paint method of one of the widgets I've added:

    qDebug() << p.fontInfo().family() ;

And this reports that the correct font is set for the QPainter in question.

But the actual font that is drawn on to the screen is not Myriad Pro,
looks more like Arial or Helvetica.

What is even more strange that on an other Mac the font is correct.

Any thoughts?

br Kusti








More information about the Qt-interest-old mailing list