Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r500 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5858#include <limits.h>
    5959
     60#if (defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE)
     61#  include <ft2build.h>
     62#  include FT_TRUETYPE_TABLES_H
     63#endif
     64
    6065// #define QFONTDATABASE_DEBUG
    6166#ifdef QFONTDATABASE_DEBUG
     
    8085QT_BEGIN_NAMESPACE
    8186
     87#define SMOOTH_SCALABLE 0xffff
     88
    8289extern int qt_defaultDpiY(); // in qfont.cpp
    8390
    84 Q_GUI_EXPORT bool qt_enable_test_font = false;
     91bool qt_enable_test_font = false;
     92
     93Q_AUTOTEST_EXPORT void qt_setQtEnableTestFont(bool value)
     94{
     95    qt_enable_test_font = value;
     96}
    8597
    8698static int getFontWeight(const QString &weightString)
     
    91103    if (s == QLatin1String("medium") ||
    92104        s == QLatin1String("normal")
    93         || s.compare(qApp->translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0)
     105        || s.compare(QApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0)
    94106        return QFont::Normal;
    95107    if (s == QLatin1String("bold")
    96         || s.compare(qApp->translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0)
     108        || s.compare(QApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0)
    97109        return QFont::Bold;
    98110    if (s == QLatin1String("demibold") || s == QLatin1String("demi bold")
    99         || s.compare(qApp->translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0)
     111        || s.compare(QApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0)
    100112        return QFont::DemiBold;
    101113    if (s == QLatin1String("black")
    102         || s.compare(qApp->translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
     114        || s.compare(QApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
    103115        return QFont::Black;
    104116    if (s == QLatin1String("light"))
     
    106118
    107119    if (s.contains(QLatin1String("bold"))
    108         || s.contains(qApp->translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) {
     120        || s.contains(QApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) {
    109121        if (s.contains(QLatin1String("demi"))
    110             || s.compare(qApp->translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0)
     122            || s.compare(QApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0)
    111123            return (int) QFont::DemiBold;
    112124        return (int) QFont::Bold;
     
    114126
    115127    if (s.contains(QLatin1String("light"))
    116         || s.compare(qApp->translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0)
     128        || s.compare(QApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0)
    117129        return (int) QFont::Light;
    118130
    119131    if (s.contains(QLatin1String("black"))
    120         || s.compare(qApp->translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
     132        || s.compare(QApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
    121133        return (int) QFont::Black;
    122134
     
    148160    QList<QFontDatabase::WritingSystem> systems;
    149161#endif
    150 #if defined(Q_WS_QWS) || defined(Q_WS_PM)
     162#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_PM)
    151163    QByteArray fileName;
    152164    int fileIndex;
    153 #endif
     165#endif // defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
    154166};
    155167
     
    167179    if (!add) return 0;
    168180
    169     if (!(count % 4))
    170         encodings = (QtFontEncoding *)
     181    if (!(count % 4)) {
     182        QtFontEncoding *newEncodings = (QtFontEncoding *)
    171183                    realloc(encodings,
    172184                             (((count+4) >> 2) << 2) * sizeof(QtFontEncoding));
     185        Q_CHECK_PTR(newEncodings);
     186        encodings = newEncodings;
     187    }
    173188    encodings[count].encoding = id;
    174189    encodings[count].xpoint = xpoint;
     
    222237        delete [] setwidthName;
    223238#endif
    224 #if defined(Q_WS_X11) || defined(Q_WS_QWS)
    225         while (count--) {
     239#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
     240        while (count) {
     241            // bitfield count-- in while condition does not work correctly in mwccsym2
     242            count--;
    226243#ifdef Q_WS_X11
    227244            free(pixelSizes[count].encodings);
     
    230247            pixelSizes[count].systems.~QList<QFontDatabase::WritingSystem>();
    231248#endif
    232 #if defined(Q_WS_QWS) || defined(Q_WS_PM)
     249#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_PM)
    233250            pixelSizes[count].fileName.~QByteArray();
    234251#endif
     
    248265    const char *setwidthName;
    249266#endif // Q_WS_X11
    250 #if defined(Q_WS_QWS) || defined(Q_WS_PM)
     267#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_PM)
    251268    bool antialiased;
    252269#endif
     
    261278
    262279    if (styleString.contains(QLatin1String("Italic"))
    263         || styleString.contains(qApp->translate("QFontDatabase", "Italic")))
     280        || styleString.contains(QApplication::translate("QFontDatabase", "Italic")))
    264281        style = QFont::StyleItalic;
    265282    else if (styleString.contains(QLatin1String("Oblique"))
    266              || styleString.contains(qApp->translate("QFontDatabase", "Oblique")))
     283             || styleString.contains(QApplication::translate("QFontDatabase", "Oblique")))
    267284        style = QFont::StyleOblique;
    268285}
     
    277294        return 0;
    278295
    279     if (!(count % 8))
    280         pixelSizes = (QtFontSize *)
     296    if (!(count % 8)) {
     297        QtFontSize *newPixelSizes = (QtFontSize *)
    281298                     realloc(pixelSizes,
    282299                              (((count+8) >> 3) << 3) * sizeof(QtFontSize));
     300        Q_CHECK_PTR(newPixelSizes);
     301        pixelSizes = newPixelSizes;
     302    }
    283303    pixelSizes[count].pixelSize = size;
    284304#ifdef Q_WS_X11
     
    289309    new (&pixelSizes[count].systems) QList<QFontDatabase::WritingSystem>;
    290310#endif
    291 #if defined(Q_WS_QWS) || defined(Q_WS_PM)
     311#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) || defined(Q_WS_PM)
    292312    new (&pixelSizes[count].fileName) QByteArray;
    293313    pixelSizes[count].fileIndex = 0;
     
    327347                high = pos;
    328348            pos = (high + low) / 2;
    329         };
     349        }
    330350        pos = low;
    331351    }
     
    334354
    335355//     qDebug("adding key (weight=%d, style=%d, oblique=%d stretch=%d) at %d", key.weight, key.style, key.oblique, key.stretch, pos);
    336     if (!(count % 8))
    337         styles = (QtFontStyle **)
     356    if (!(count % 8)) {
     357        QtFontStyle **newStyles = (QtFontStyle **)
    338358                 realloc(styles, (((count+8) >> 3) << 3) * sizeof(QtFontStyle *));
    339 
     359        Q_CHECK_PTR(newStyles);
     360        styles = newStyles;
     361    }
     362
     363    QtFontStyle *style = new QtFontStyle(key);
    340364    memmove(styles + pos + 1, styles + pos, (count-pos)*sizeof(QtFontStyle *));
    341     styles[pos] = new QtFontStyle(key);
     365    styles[pos] = style;
    342366    count++;
    343367    return styles[pos];
     
    371395#endif
    372396        name(n), count(0), foundries(0)
    373 #if defined(Q_WS_QWS)
     397#if defined(Q_WS_QWS) ||   defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
    374398        , bogusWritingSystems(false)
    375399#endif
     
    401425
    402426    QString name;
    403 #ifdef Q_WS_X11
     427#if defined(Q_WS_X11) ||   defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
    404428    QByteArray fontFilename;
    405429    int fontFileIndex;
     
    411435    QtFontFoundry **foundries;
    412436
    413 #ifdef Q_WS_QWS
     437#if defined(Q_WS_QWS) ||   defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
    414438    bool bogusWritingSystems;
    415439    QStringList fallbackFamilies;
     
    444468        return 0;
    445469
    446     if (!(count % 8))
    447         foundries = (QtFontFoundry **)
     470    if (!(count % 8)) {
     471        QtFontFoundry **newFoundries = (QtFontFoundry **)
    448472                    realloc(foundries,
    449473                             (((count+8) >> 3) << 3) * sizeof(QtFontFoundry *));
     474        Q_CHECK_PTR(newFoundries);
     475        foundries = newFoundries;
     476    }
    450477
    451478    foundries[count] = new QtFontFoundry(f);
     
    455482// ### copied to tools/makeqpf/qpf2.cpp
    456483
    457 #if ((defined(Q_WS_QWS) || defined(Q_WS_PM)) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN) || defined(Q_WS_MAC)
     484#if ((defined(Q_WS_QWS) || defined(Q_WS_PM)) && !defined(QT_NO_FREETYPE)) || defined(Q_WS_WIN)  || defined(Q_OS_SYMBIAN) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA))
    458485// see the Unicode subset bitfields in the MSDN docs
    459486static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = {
     
    519546    { 0, 127 }, // same as latin1
    520547        // Other,
    521     { 126, 127 }
     548    { 126, 127 },
     549        // Ogham,
     550    { 78, 127 },
     551        // Runic,
     552    { 79, 127 },
     553        // Nko,
     554    { 14, 127 },
    522555};
    523556
     
    576609#endif
    577610
     611#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
     612// class with virtual destructor, derived in qfontdatabase_s60.cpp
     613class QFontDatabaseS60Store
     614{
     615public:
     616    virtual ~QFontDatabaseS60Store() {}
     617};
     618#endif
     619
    578620class QFontDatabasePrivate
    579621{
     
    586628#if defined(Q_WS_PM)
    587629        , valid(false)
     630#endif
     631#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
     632          , s60Store(0)
    588633#endif
    589634    { }
     
    598643        families = 0;
    599644        count = 0;
     645#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
     646        if (s60Store) {
     647            delete s60Store;
     648            s60Store = 0;
     649        }
     650#endif
    600651        // don't clear the memory fonts!
    601652    }
     
    625676#if defined(Q_WS_QWS)
    626677    bool loadFromCache(const QString &fontPath);
     678    void addQPF2File(const QByteArray &file);
     679#endif // Q_WS_QWS
     680#if defined(Q_WS_QWS) ||   defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
    627681    void addFont(const QString &familyname, const char *foundryname, int weight,
    628682                 bool italic, int pixelSize, const QByteArray &file, int fileIndex,
    629683                 bool antialiased,
    630684                 const QList<QFontDatabase::WritingSystem> &writingSystems = QList<QFontDatabase::WritingSystem>());
    631     void addQPF2File(const QByteArray &file);
    632685#ifndef QT_NO_FREETYPE
    633686    QStringList addTTFile(const QByteArray &file, const QByteArray &fontData = QByteArray());
    634 #endif
    635 
     687#endif // QT_NO_FREETYPE
     688#endif
     689#if defined(Q_WS_QWS)
    636690    QDataStream *stream;
    637691    QStringList fallbackFamilies;
     692#elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
     693    const QFontDatabaseS60Store *s60Store;
    638694#endif
    639695
     
    666722                low = pos;
    667723            pos = (high + low) / 2;
    668         };
     724        }
    669725        if (!res)
    670726            return families[pos];
     
    677733
    678734    // qDebug("adding family %s at %d total=%d", f.latin1(), pos, count);
    679     if (!(count % 8))
    680         families = (QtFontFamily **)
     735    if (!(count % 8)) {
     736        QtFontFamily **newFamilies = (QtFontFamily **)
    681737                   realloc(families,
    682738                            (((count+8) >> 3) << 3) * sizeof(QtFontFamily *));
    683 
     739        Q_CHECK_PTR(newFamilies);
     740        families = newFamilies;
     741    }
     742
     743    QtFontFamily *family = new QtFontFamily(f);
    684744    memmove(families + pos + 1, families + pos, (count-pos)*sizeof(QtFontFamily *));
    685     families[pos] = new QtFontFamily(f);
     745    families[pos] = family;
    686746    count++;
    687747    return families[pos];
    688748}
    689749
     750#if defined(Q_WS_QWS) ||   defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
     751void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundryname, int weight, bool italic, int pixelSize,
     752                                   const QByteArray &file, int fileIndex, bool antialiased,
     753                                   const QList<QFontDatabase::WritingSystem> &writingSystems)
     754{
     755//    qDebug() << "Adding font" << familyname << weight << italic << pixelSize << file << fileIndex << antialiased;
     756    QtFontStyle::Key styleKey;
     757    styleKey.style = italic ? QFont::StyleItalic : QFont::StyleNormal;
     758    styleKey.weight = weight;
     759    styleKey.stretch = 100;
     760    QtFontFamily *f = family(familyname, true);
     761
     762    if (writingSystems.isEmpty()) {
     763        for (int ws = 1; ws < QFontDatabase::WritingSystemsCount; ++ws) {
     764            f->writingSystems[ws] = QtFontFamily::Supported;
     765        }
     766        f->bogusWritingSystems = true;
     767    } else {
     768        for (int i = 0; i < writingSystems.count(); ++i) {
     769            f->writingSystems[writingSystems.at(i)] = QtFontFamily::Supported;
     770        }
     771    }
     772
     773    QtFontFoundry *foundry = f->foundry(QString::fromLatin1(foundryname), true);
     774    QtFontStyle *style = foundry->style(styleKey,  true);
     775    style->smoothScalable = (pixelSize == 0);
     776    style->antialiased = antialiased;
     777    QtFontSize *size = style->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true);
     778    size->fileName = file;
     779    size->fileIndex = fileIndex;
     780
     781#if defined(Q_WS_QWS)
     782    if (stream) {
     783        *stream << familyname << foundry->name << weight << quint8(italic) << pixelSize
     784                << file << fileIndex << quint8(antialiased);
     785        *stream << quint8(writingSystems.count());
     786        for (int i = 0; i < writingSystems.count(); ++i)
     787            *stream << quint8(writingSystems.at(i));
     788    }
     789#else // ..in case of defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE)
     790    f->fontFilename = file;
     791    f->fontFileIndex = fileIndex;
     792#endif
     793}
     794#endif
     795
     796#if (defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE)
     797QStringList QFontDatabasePrivate::addTTFile(const QByteArray &file, const QByteArray &fontData)
     798{
     799    QStringList families;
     800    extern FT_Library qt_getFreetype();
     801    FT_Library library = qt_getFreetype();
     802
     803    int index = 0;
     804    int numFaces = 0;
     805    do {
     806        FT_Face face;
     807        FT_Error error;
     808        if (!fontData.isEmpty()) {
     809            error = FT_New_Memory_Face(library, (const FT_Byte *)fontData.constData(), fontData.size(), index, &face);
     810        } else {
     811            error = FT_New_Face(library, file, index, &face);
     812        }
     813        if (error != FT_Err_Ok) {
     814            qDebug() << "FT_New_Face failed with index" << index << ":" << hex << error;
     815            break;
     816        }
     817        numFaces = face->num_faces;
     818
     819        int weight = QFont::Normal;
     820        bool italic = face->style_flags & FT_STYLE_FLAG_ITALIC;
     821
     822        if (face->style_flags & FT_STYLE_FLAG_BOLD)
     823            weight = QFont::Bold;
     824
     825        QList<QFontDatabase::WritingSystem> writingSystems;
     826        // detect symbol fonts
     827        for (int i = 0; i < face->num_charmaps; ++i) {
     828            FT_CharMap cm = face->charmaps[i];
     829            if (cm->encoding == ft_encoding_adobe_custom
     830                    || cm->encoding == ft_encoding_symbol) {
     831                writingSystems.append(QFontDatabase::Symbol);
     832                break;
     833            }
     834        }
     835        if (writingSystems.isEmpty()) {
     836            TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
     837            if (os2) {
     838                quint32 unicodeRange[4] = {
     839                    os2->ulUnicodeRange1, os2->ulUnicodeRange2, os2->ulUnicodeRange3, os2->ulUnicodeRange4
     840                };
     841                quint32 codePageRange[2] = {
     842                    os2->ulCodePageRange1, os2->ulCodePageRange2
     843                };
     844
     845                writingSystems = determineWritingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
     846                //for (int i = 0; i < writingSystems.count(); ++i)
     847                //    qDebug() << QFontDatabase::writingSystemName(writingSystems.at(i));
     848            }
     849        }
     850
     851        QString family = QString::fromAscii(face->family_name);
     852        families.append(family);
     853        addFont(family, /*foundry*/ "", weight, italic,
     854                /*pixelsize*/ 0, file, index, /*antialias*/ true, writingSystems);
     855
     856        FT_Done_Face(face);
     857        ++index;
     858    } while (index < numFaces);
     859    return families;
     860}
     861#endif
    690862
    691863static const int scriptForWritingSystem[] = {
     
    730902    QUnicodeTables::Common, // Symbol
    731903    QUnicodeTables::Ogham,  // Ogham
    732     QUnicodeTables::Runic // Runic
     904    QUnicodeTables::Runic, // Runic
     905    QUnicodeTables::Nko // Nko
    733906};
    734907
     
    738911{
    739912    return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala)
    740             || writingSystem == QFontDatabase::Khmer);
     913            || writingSystem == QFontDatabase::Khmer || writingSystem == QFontDatabase::Nko);
    741914}
    742915static inline bool scriptRequiresOpenType(int script)
    743916{
    744917    return ((script >= QUnicodeTables::Syriac && script <= QUnicodeTables::Sinhala)
    745             || script == QUnicodeTables::Khmer);
     918            || script == QUnicodeTables::Khmer || script == QUnicodeTables::Nko);
    746919}
    747920#endif
     
    806979static void match(int script, const QFontDef &request,
    807980                  const QString &family_name, const QString &foundry_name, int force_encoding_id,
    808                   QtFontDesc *desc, const QList<int> &blacklistedFamilies = QList<int>());
     981                  QtFontDesc *desc, const QList<int> &blacklistedFamilies = QList<int>(), bool forceXLFD=false);
    809982
    810983#if defined(Q_WS_X11) || defined(Q_WS_QWS)
     
    815988        fontDef->family += QString::fromLatin1(" [");
    816989        fontDef->family += desc.foundry->name;
    817         fontDef->family += QString::fromLatin1("]");
     990        fontDef->family += QLatin1Char(']');
    818991    }
    819992
     
    8371010#endif
    8381011
    839 #if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_PM)
     1012#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || defined(Q_WS_PM)
    8401013static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key)
    8411014{
     
    8501023    }
    8511024}
     1025#endif
    8521026
    8531027static QStringList familyList(const QFontDef &req)
     
    8781052    return family_list;
    8791053}
    880 #endif
    8811054
    8821055Q_GLOBAL_STATIC(QFontDatabasePrivate, privateDb)
     
    9001073#elif defined(Q_WS_QWS)
    9011074#  include "qfontdatabase_qws.cpp"
     1075#elif defined(Q_OS_SYMBIAN)
     1076#  include "qfontdatabase_s60.cpp"
    9021077#endif
    9031078QT_END_INCLUDE_NAMESPACE
     
    12041379static void match(int script, const QFontDef &request,
    12051380                  const QString &family_name, const QString &foundry_name, int force_encoding_id,
    1206                   QtFontDesc *desc, const QList<int> &blacklistedFamilies)
     1381                  QtFontDesc *desc, const QList<int> &blacklistedFamilies, bool forceXLFD)
    12071382{
    12081383    Q_UNUSED(force_encoding_id);
     
    12191394             "    weight: %d, style: %d\n"
    12201395             "    stretch: %d\n"
    1221              "    pixelSize: %d\n"
     1396             "    pixelSize: %g\n"
    12221397             "    pitch: %c",
    12231398             family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(),
     
    12391414    unsigned int score = ~0u;
    12401415
     1416#ifdef Q_WS_X11
     1417    load(family_name, script, forceXLFD);
     1418#else
     1419    Q_UNUSED(forceXLFD);
    12411420    load(family_name, script);
     1421#endif
    12421422
    12431423    QFontDatabasePrivate *db = privateDb();
     
    13031483    QString result;
    13041484    if (weight >= QFont::Black)
    1305         result = qApp->translate("QFontDatabase", "Black");
     1485        result = QApplication::translate("QFontDatabase", "Black");
    13061486    else if (weight >= QFont::Bold)
    1307         result = qApp->translate("QFontDatabase", "Bold");
     1487        result = QApplication::translate("QFontDatabase", "Bold");
    13081488    else if (weight >= QFont::DemiBold)
    1309         result = qApp->translate("QFontDatabase", "Demi Bold");
     1489        result = QApplication::translate("QFontDatabase", "Demi Bold");
    13101490    else if (weight < QFont::Normal)
    1311         result = qApp->translate("QFontDatabase", "Light");
     1491        result = QApplication::translate("QFontDatabase", "Light");
    13121492
    13131493    if (style == QFont::StyleItalic)
    1314         result += QLatin1Char(' ') + qApp->translate("QFontDatabase", "Italic");
     1494        result += QLatin1Char(' ') + QApplication::translate("QFontDatabase", "Italic");
    13151495    else if (style == QFont::StyleOblique)
    1316         result += QLatin1Char(' ') + qApp->translate("QFontDatabase", "Oblique");
     1496        result += QLatin1Char(' ') + QApplication::translate("QFontDatabase", "Oblique");
    13171497
    13181498    if (result.isEmpty())
    1319         result = qApp->translate("QFontDatabase", "Normal");
     1499        result = QApplication::translate("QFontDatabase", "Normal");
    13201500
    13211501    return result.simplified();
     
    13491529    \brief The QFontDatabase class provides information about the fonts available in the underlying window system.
    13501530
    1351     \ingroup environment
    1352     \ingroup multimedia
    1353     \ingroup text
     1531    \ingroup appearance
    13541532
    13551533    The most common uses of this class are to query the database for
     
    13601538
    13611539    If the font family is available from two or more foundries the
    1362     foundry name is included in the family name, e.g. "Helvetica
    1363     [Adobe]" and "Helvetica [Cronyx]". When you specify a family you
    1364     can either use the old hyphenated Qt 2.x "foundry-family" format,
    1365     e.g. "Cronyx-Helvetica", or the new bracketed Qt 3.x "family
    1366     [foundry]" format e.g. "Helvetica [Cronyx]". If the family has a
    1367     foundry it is always returned, e.g. by families(), using the
    1368     bracketed format.
     1540    foundry name is included in the family name; for example:
     1541    "Helvetica [Adobe]" and "Helvetica [Cronyx]". When you specify a
     1542    family, you can either use the old hyphenated "foundry-family"
     1543    format or the bracketed "family [foundry]" format; for example:
     1544    "Cronyx-Helvetica" or "Helvetica [Cronyx]". If the family has a
     1545    foundry it is always returned using the bracketed format, as is
     1546    the case with the value returned by families().
    13691547
    13701548    The font() function returns a QFont given a family, style and
     
    14431621    \value Ogham
    14441622    \value Runic
     1623    \value Nko
    14451624
    14461625    \omitvalue WritingSystemsCount
     
    15491728                    str += QLatin1String(" [");
    15501729                    str += foundry;
    1551                     str += QLatin1String("]");
     1730                    str += QLatin1Char(']');
    15521731                }
    15531732                flist.append(str);
     
    21172296        name = QT_TRANSLATE_NOOP("QFontDatabase", "Runic");
    21182297        break;
     2298    case Nko:
     2299        name = QT_TRANSLATE_NOOP("QFontDatabase", "N'Ko");
     2300        break;
    21192301    default:
    21202302        Q_ASSERT_X(false, "QFontDatabase::writingSystemName", "invalid 'writingSystem' parameter");
    21212303        break;
    21222304    }
    2123     return qApp ? qApp->translate("QFontDatabase", name) : QString::fromLatin1(name);
     2305    return QApplication::translate("QFontDatabase", name);
    21242306}
    21252307
     
    23082490        break;
    23092491    case Vietnamese:
    2310         break;
     2492    {
     2493        static const char vietnameseUtf8[] = {
     2494            char(0xef), char(0xbb), char(0xbf), char(0xe1), char(0xbb), char(0x97),
     2495            char(0xe1), char(0xbb), char(0x99),
     2496            char(0xe1), char(0xbb), char(0x91),
     2497            char(0xe1), char(0xbb), char(0x93),
     2498        };
     2499        sample += QString::fromUtf8(vietnameseUtf8, sizeof(vietnameseUtf8));
     2500        break;
     2501    }
    23112502    case Ogham:
    23122503        sample += QChar(0x1681);
     
    23202511        sample += QChar(0x16a2);
    23212512        sample += QChar(0x16a3);
     2513        break;
     2514    case Nko:
     2515        sample += QChar(0x7ca);
     2516        sample += QChar(0x7cb);
     2517        sample += QChar(0x7cc);
     2518        sample += QChar(0x7cd);
    23222519        break;
    23232520    default:
     
    24812678    will not produce readable output.
    24822679
    2483     \sa threads.html#painting-in-threads
     2680    \sa {Thread-Support in Qt Modules#Painting In Threads}{Painting In Threads}
    24842681*/
    24852682
Note: See TracChangeset for help on using the changeset viewer.