[Interest] Unable to use a specific font on Mac OS X

Nikos Chantziaras realnc at arcor.de
Tue Feb 28 06:41:07 CET 2012


Using either Qt 4.7.4 or 4.8.0, I am unable to use a certain font in Qt. 
  The font in question is "Garamond Premier Pro" (it's a commercial 
font).  In this minimal example:

   void paintEvent(QPaintEvent*)
   {
       QPainter p(this);
       p.setFont(QFont("Garamond Premier Pro"));
       p.drawText(0, QFontMetrics(p.font()).ascent(), "This is a test.");
       qDebug() << QFontInfo(p.font()).family();
   }

The above will result in "Helvetica" being printed on stdout, and indeed 
the widget renders the text using Helvetica (which is the fallback 
font.)  Note that if I put a QFontComboBox somewhere, "Garamond Premier 
Pro" is listed as an available choice, but is also rendered in Helvetica 
inside the QFontComboBox list.

Garamond Premier Pro is an OTF font, and it works without issues with 
other non-Qt Mac applications.

Has anyone else encountered this?



More information about the Interest mailing list