summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-10-19 10:48:23 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-10-20 11:43:55 (GMT)
commita282eb79745998c38055690577ed829586a00bb1 (patch)
treece263f45930d5f2498fa552cc9d6664fa5ea0c71 /src/gui/text
parente12224ab0189cce441f35eba730d843bf6d8f1c8 (diff)
downloadQt-a282eb79745998c38055690577ed829586a00bb1.zip
Qt-a282eb79745998c38055690577ed829586a00bb1.tar.gz
Qt-a282eb79745998c38055690577ed829586a00bb1.tar.bz2
Fixed font rendering in manually built Qt on ARMv6.
The pixelSize ends up being 0 unless these changes are applied. Must be a compiler bug in GCC 4.3.x, fixed in GCC 4.4.1. Reviewed-by: Prasanth Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfontdatabase_x11.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp
index a7aa2ce..9bf6cc8 100644
--- a/src/gui/text/qfontdatabase_x11.cpp
+++ b/src/gui/text/qfontdatabase_x11.cpp
@@ -1891,6 +1891,18 @@ QFontEngine *QFontDatabase::loadXlfd(int screen, int script, const QFontDef &req
return fe;
}
+#if (defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6)) && defined(Q_CC_GNU) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
+#define NEEDS_GCC_BUG_WORKAROUND
+#endif
+
+#ifdef NEEDS_GCC_BUG_WORKAROUND
+static inline void gccBugWorkaround(const QFontDef &req)
+{
+ char buffer[8];
+ snprintf(buffer, 8, "%f", req.pixelSize);
+}
+#endif
+
/*! \internal
Loads a QFontEngine for the specified \a script that matches the
QFontDef \e request member variable.
@@ -1902,9 +1914,15 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
// normalize the request to get better caching
QFontDef req = d->request;
if (req.pixelSize <= 0)
- req.pixelSize = floor(qt_pixelSize(req.pointSize, d->dpi) * 100 + 0.5) / 100;
+ req.pixelSize = qFloor(qt_pixelSize(req.pointSize, d->dpi) * 100.0 + 0.5) * 0.01;
if (req.pixelSize < 1)
req.pixelSize = 1;
+
+#ifdef NEEDS_GCC_BUG_WORKAROUND
+ // req.pixelSize ends up with a bogus value unless this workaround is called
+ gccBugWorkaround(req);
+#endif
+
if (req.weight == 0)
req.weight = QFont::Normal;
if (req.stretch == 0)
@@ -1940,7 +1958,6 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
#ifndef QT_NO_FONTCONFIG
} else if (X11->has_fontconfig) {
fe = loadFc(d, script, req);
-
if (fe != 0 && fe->fontDef.pixelSize != req.pixelSize && mainThread && qt_is_gui_used) {
QFontEngine *xlfdFontEngine = loadXlfd(d->screen, script, req);
if (xlfdFontEngine->fontDef.family == fe->fontDef.family) {