qt-bugs@ issue : 173297 Trolltech task ID : 175024 applied: no author: Matthew Woehlke This patch works around broken QFontInfo::fixedPitch by always using a glyph metrics comparison test to guess the information. This has the property of both ignoring (bad) and not relying on (good) any information that might be provided by the OS's font facility. On further conversation with TT (at which point they were finally able to reproduce the problem), it seems fixedPitch() only breaks if one has called setFixedPitch(true) on the QFont, and the selected font is not fixed pitch. This patch should be considered temporary until TT has a better fix. --- src/gui/text/qfont.cpp +++ src/gui/text/qfont.cpp @@ -2093,7 +2093,6 @@ { QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); Q_ASSERT(engine != 0); -#ifdef Q_OS_MAC if (!engine->fontDef.fixedPitchComputed) { QChar ch[2] = { QLatin1Char('i'), QLatin1Char('m') }; QGlyphLayout g[2]; @@ -2102,7 +2101,6 @@ engine->fontDef.fixedPitch = g[0].advance.x == g[1].advance.x; engine->fontDef.fixedPitchComputed = true; } -#endif return engine->fontDef.fixedPitch; } --- src/gui/text/qfont_p.h +++ src/gui/text/qfont_p.h @@ -66,9 +66,7 @@ styleStrategy(QFont::PreferDefault), styleHint(QFont::AnyStyle), weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(100), ignorePitch(true) -#ifdef Q_WS_MAC ,fixedPitchComputed(false) -#endif { } @@ -90,7 +88,7 @@ uint stretch : 12; // 0-400 uint ignorePitch : 1; - uint fixedPitchComputed : 1; // for Mac OS X only + uint fixedPitchComputed : 1; uint reserved : 16; // for future extensions bool exactMatch(const QFontDef &other) const;