From a282eb79745998c38055690577ed829586a00bb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 19 Oct 2010 12:48:23 +0200 Subject: 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 --- src/gui/text/qfontdatabase_x11.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/gui/text') diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index a7aa2ce282..9bf6cc810c 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) { -- cgit v1.2.3 From 0ade09152067324f74678f2de4d447b6e0280600 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Sat, 23 Oct 2010 10:26:16 +0200 Subject: Fixed many spelling errors. --- src/gui/text/qfontdatabase_x11.cpp | 2 +- src/gui/text/qfontengine_p.h | 2 +- src/gui/text/qfontengine_win.cpp | 2 +- src/gui/text/qfontsubset.cpp | 4 ++-- src/gui/text/qtextdocument_p.cpp | 4 ++-- src/gui/text/qtextlayout.cpp | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/gui/text') diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index 9bf6cc810c..ecc4690e67 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -2006,7 +2006,7 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) FcFontSet *set = FcConfigGetFonts(config, FcSetApplication); if (!set) { - FcConfigAppFontAddFile(config, (const FcChar8 *)":/non-existant"); + FcConfigAppFontAddFile(config, (const FcChar8 *)":/non-existent"); set = FcConfigGetFonts(config, FcSetApplication); // try again if (!set) return; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 571cf981a2..fc26eef08b 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -158,7 +158,7 @@ public: virtual QFixed emSquareSize() const { return ascent(); } - /* returns 0 as glyph index for non existant glyphs */ + /* returns 0 as glyph index for non existent glyphs */ virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const = 0; /** diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 7609ee560a..5f257524be 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -1209,7 +1209,7 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform) QImage indexed(mask->width(), mask->height(), QImage::Format_Indexed8); - // ### This part is kinda pointless, but we'll crash later if we dont because some + // ### This part is kinda pointless, but we'll crash later if we don't because some // code paths expects there to be colortables for index8-bit... QVector colors(256); for (int i=0; i<256; ++i) diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp index e49f5b4554..22833584b9 100644 --- a/src/gui/text/qfontsubset.cpp +++ b/src/gui/text/qfontsubset.cpp @@ -697,7 +697,7 @@ static QTtfTable generateHead(const qttf_head_table &head) // Bits 5-10: These should be set according to Apple's specification . However, they are not implemented in OpenType. // Bit 11: Font data is 'lossless,' as a result of having been compressed and decompressed with the Agfa MicroType Express engine. // Bit 12: Font converted (produce compatible metrics) -// Bit 13: Font optimised for ClearType +// Bit 13: Font optimized for ClearType // Bit 14: Reserved, set to 0 // Bit 15: Reserved, set to 0 << quint16(0) @@ -1008,7 +1008,7 @@ static void convertPath(const QPainterPath &path, QList *points, QLis np.x = (i1_x + i2_x) >> 1; np.y = (i1_y + i2_y) >> 1; if (try_reduce) { - // see if we can optimise out the last onCurve point + // see if we can optimize out the last onCurve point int mx = (points->at(points->size() - 2).x + base[2].x) >> 1; int my = (points->at(points->size() - 2).y + base[2].y) >> 1; if (qAbs(mx - base[3].x) <= split_limit && qAbs(my = base[3].y) <= split_limit) diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 213db7ed9f..0bdd20d347 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -320,7 +320,7 @@ void QTextDocumentPrivate::setLayout(QAbstractTextDocumentLayout *layout) void QTextDocumentPrivate::insert_string(int pos, uint strPos, uint length, int format, QTextUndoCommand::Operation op) { - // ##### optimise when only appending to the fragment! + // ##### optimize when only appending to the fragment! Q_ASSERT(noBlockInString(text.mid(strPos, length))); split(pos); @@ -1446,7 +1446,7 @@ void QTextDocumentPrivate::clearFrame(QTextFrame *f) void QTextDocumentPrivate::scan_frames(int pos, int charsRemoved, int charsAdded) { - // ###### optimise + // ###### optimize Q_UNUSED(pos); Q_UNUSED(charsRemoved); Q_UNUSED(charsAdded); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index f432b7e629..f1278b9966 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1615,7 +1615,7 @@ void QTextLine::setLineWidth(qreal width) if (line.length && line.textWidth <= line.width && line.from + line.length == eng->layoutData->string.length()) - // no need to do anything if the line is already layouted and the last one. This optimisation helps + // no need to do anything if the line is already layouted and the last one. This optimization helps // when using things in a single line layout. return; line.length = 0; -- cgit v1.2.3