Sophie

Sophie

distrib > Mandriva > 2008.0 > x86_64 > media > main-backports-src > by-pkgid > f0c263bbe13f82332c5b355ec4223468 > files > 8

qt4-4.3.3-5mdv2008.0.src.rpm

qt-bugs@ issue : 173297
Trolltech task ID : 175024 (status: pending for Qt 4.4.0)
applied: no
author: Matthew Woehlke <mw_triad@users.sourceforge.net>

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;