Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/text/qfontdatabase_x11.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4242#include <qplatformdefs.h>
    4343
    44 #include <qdatetime.h>
    4544#include <qdebug.h>
    4645#include <qpaintdevice.h>
     46#include <qelapsedtimer.h>
    4747
    4848#include <private/qt_x11_p.h>
     
    7878extern double qt_pointSize(double pixelSize, int dpi);
    7979extern double qt_pixelSize(double pointSize, int dpi);
     80
     81// from qapplication.cpp
     82extern bool qt_is_gui_used;
    8083
    8184static inline void capitalize (char *s)
     
    12191222
    12201223#ifdef QFONTDATABASE_DEBUG
    1221     QTime t;
     1224    QElapsedTimer t;
    12221225    t.start();
    12231226#endif
     
    13021305        return;
    13031306
    1304     QTime t;
     1307    QElapsedTimer t;
    13051308    t.start();
    13061309
     
    13151318
    13161319    loadFontConfig();
    1317     FD_DEBUG("QFontDatabase: loaded FontConfig: %d ms", t.elapsed());
     1320    FD_DEBUG("QFontDatabase: loaded FontConfig: %d ms", int(t.elapsed()));
    13181321#endif
    13191322
     
    18891892}
    18901893
     1894#if (defined(QT_ARCH_ARM) || defined(QT_ARCH_ARMV6)) && defined(Q_CC_GNU) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 3)
     1895#define NEEDS_GCC_BUG_WORKAROUND
     1896#endif
     1897
     1898#ifdef NEEDS_GCC_BUG_WORKAROUND
     1899static inline void gccBugWorkaround(const QFontDef &req)
     1900{
     1901    char buffer[8];
     1902    snprintf(buffer, 8, "%f", req.pixelSize);
     1903}
     1904#endif
     1905
    18911906/*! \internal
    18921907  Loads a QFontEngine for the specified \a script that matches the
     
    19001915    QFontDef req = d->request;
    19011916    if (req.pixelSize <= 0)
    1902         req.pixelSize = floor(qt_pixelSize(req.pointSize, d->dpi) * 100 + 0.5) / 100;
     1917        req.pixelSize = qFloor(qt_pixelSize(req.pointSize, d->dpi) * 100.0 + 0.5) * 0.01;
    19031918    if (req.pixelSize < 1)
    19041919        req.pixelSize = 1;
     1920
     1921#ifdef NEEDS_GCC_BUG_WORKAROUND
     1922    // req.pixelSize ends up with a bogus value unless this workaround is called
     1923    gccBugWorkaround(req);
     1924#endif
     1925
    19051926    if (req.weight == 0)
    19061927        req.weight = QFont::Normal;
     
    19381959        } else if (X11->has_fontconfig) {
    19391960            fe = loadFc(d, script, req);
    1940 
    1941             if (fe != 0 && fe->fontDef.pixelSize != req.pixelSize) {
    1942                 delete fe;
    1943                 fe = loadXlfd(d->screen, script, req);
     1961            if (fe != 0 && fe->fontDef.pixelSize != req.pixelSize && mainThread && qt_is_gui_used) {
     1962                QFontEngine *xlfdFontEngine = loadXlfd(d->screen, script, req);
     1963                if (xlfdFontEngine->fontDef.family == fe->fontDef.family) {
     1964                    delete fe;
     1965                    fe = xlfdFontEngine;
     1966                } else {
     1967                    delete xlfdFontEngine;
     1968                }
    19441969            }
    19451970
    19461971
    19471972#endif
    1948         } else if (mainThread) {
     1973        } else if (mainThread && qt_is_gui_used) {
    19491974            fe = loadXlfd(d->screen, script, req);
    19501975        }
     
    19822007    FcFontSet *set = FcConfigGetFonts(config, FcSetApplication);
    19832008    if (!set) {
    1984         FcConfigAppFontAddFile(config, (const FcChar8 *)":/non-existant");
     2009        FcConfigAppFontAddFile(config, (const FcChar8 *)":/non-existent");
    19852010        set = FcConfigGetFonts(config, FcSetApplication); // try again
    19862011        if (!set)
Note: See TracChangeset for help on using the changeset viewer.