| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). | 
|---|
| 4 | ** All rights reserved. | 
|---|
| 5 | ** Contact: Nokia Corporation (qt-info@nokia.com) | 
|---|
| 6 | ** | 
|---|
| 7 | ** This file is part of the QtGui module of the Qt Toolkit. | 
|---|
| 8 | ** | 
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$ | 
|---|
| 10 | ** Commercial Usage | 
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in | 
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the | 
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in | 
|---|
| 14 | ** a written agreement between you and Nokia. | 
|---|
| 15 | ** | 
|---|
| 16 | ** GNU Lesser General Public License Usage | 
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser | 
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software | 
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the | 
|---|
| 20 | ** packaging of this file.  Please review the following information to | 
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements | 
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | 
|---|
| 23 | ** | 
|---|
| 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. | 
|---|
| 27 | ** | 
|---|
| 28 | ** GNU General Public License Usage | 
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU | 
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software | 
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 32 | ** packaging of this file.  Please review the following information to | 
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be | 
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html. | 
|---|
| 35 | ** | 
|---|
| 36 | ** If you have questions regarding the use of this file, please contact | 
|---|
| 37 | ** Nokia at qt-info@nokia.com. | 
|---|
| 38 | ** $QT_END_LICENSE$ | 
|---|
| 39 | ** | 
|---|
| 40 | ****************************************************************************/ | 
|---|
| 41 |  | 
|---|
| 42 | #ifndef QFONTDATABASE_H | 
|---|
| 43 | #define QFONTDATABASE_H | 
|---|
| 44 |  | 
|---|
| 45 | #include <QtGui/qwindowdefs.h> | 
|---|
| 46 | #include <QtCore/qstring.h> | 
|---|
| 47 | #include <QtGui/qfont.h> | 
|---|
| 48 | #ifdef QT3_SUPPORT | 
|---|
| 49 | #include <QtCore/qstringlist.h> | 
|---|
| 50 | #include <QtCore/qlist.h> | 
|---|
| 51 | #endif | 
|---|
| 52 |  | 
|---|
| 53 | QT_BEGIN_HEADER | 
|---|
| 54 |  | 
|---|
| 55 | QT_BEGIN_NAMESPACE | 
|---|
| 56 |  | 
|---|
| 57 | QT_MODULE(Gui) | 
|---|
| 58 |  | 
|---|
| 59 | class QStringList; | 
|---|
| 60 | template <class T> class QList; | 
|---|
| 61 | struct QFontDef; | 
|---|
| 62 | class QFontEngine; | 
|---|
| 63 |  | 
|---|
| 64 | class QFontDatabasePrivate; | 
|---|
| 65 |  | 
|---|
| 66 | class Q_GUI_EXPORT QFontDatabase | 
|---|
| 67 | { | 
|---|
| 68 | Q_GADGET | 
|---|
| 69 | Q_ENUMS(WritingSystem) | 
|---|
| 70 | public: | 
|---|
| 71 | // do not re-order or delete entries from this enum without updating the | 
|---|
| 72 | // QPF2 format and makeqpf!! | 
|---|
| 73 | enum WritingSystem { | 
|---|
| 74 | Any, | 
|---|
| 75 |  | 
|---|
| 76 | Latin, | 
|---|
| 77 | Greek, | 
|---|
| 78 | Cyrillic, | 
|---|
| 79 | Armenian, | 
|---|
| 80 | Hebrew, | 
|---|
| 81 | Arabic, | 
|---|
| 82 | Syriac, | 
|---|
| 83 | Thaana, | 
|---|
| 84 | Devanagari, | 
|---|
| 85 | Bengali, | 
|---|
| 86 | Gurmukhi, | 
|---|
| 87 | Gujarati, | 
|---|
| 88 | Oriya, | 
|---|
| 89 | Tamil, | 
|---|
| 90 | Telugu, | 
|---|
| 91 | Kannada, | 
|---|
| 92 | Malayalam, | 
|---|
| 93 | Sinhala, | 
|---|
| 94 | Thai, | 
|---|
| 95 | Lao, | 
|---|
| 96 | Tibetan, | 
|---|
| 97 | Myanmar, | 
|---|
| 98 | Georgian, | 
|---|
| 99 | Khmer, | 
|---|
| 100 | SimplifiedChinese, | 
|---|
| 101 | TraditionalChinese, | 
|---|
| 102 | Japanese, | 
|---|
| 103 | Korean, | 
|---|
| 104 | Vietnamese, | 
|---|
| 105 |  | 
|---|
| 106 | Symbol, | 
|---|
| 107 | Other = Symbol, | 
|---|
| 108 |  | 
|---|
| 109 | Ogham, | 
|---|
| 110 | Runic, | 
|---|
| 111 | Nko, | 
|---|
| 112 |  | 
|---|
| 113 | WritingSystemsCount | 
|---|
| 114 | }; | 
|---|
| 115 |  | 
|---|
| 116 | static QList<int> standardSizes(); | 
|---|
| 117 |  | 
|---|
| 118 | QFontDatabase(); | 
|---|
| 119 |  | 
|---|
| 120 | QList<WritingSystem> writingSystems() const; | 
|---|
| 121 | QList<WritingSystem> writingSystems(const QString &family) const; | 
|---|
| 122 |  | 
|---|
| 123 | QStringList families(WritingSystem writingSystem = Any) const; | 
|---|
| 124 | QStringList styles(const QString &family) const; | 
|---|
| 125 | QList<int> pointSizes(const QString &family, const QString &style = QString()); | 
|---|
| 126 | QList<int> smoothSizes(const QString &family, const QString &style); | 
|---|
| 127 | QString styleString(const QFont &font); | 
|---|
| 128 | QString styleString(const QFontInfo &fontInfo); | 
|---|
| 129 |  | 
|---|
| 130 | QFont font(const QString &family, const QString &style, int pointSize) const; | 
|---|
| 131 |  | 
|---|
| 132 | bool isBitmapScalable(const QString &family, const QString &style = QString()) const; | 
|---|
| 133 | bool isSmoothlyScalable(const QString &family, const QString &style = QString()) const; | 
|---|
| 134 | bool isScalable(const QString &family, const QString &style = QString()) const; | 
|---|
| 135 | bool isFixedPitch(const QString &family, const QString &style = QString()) const; | 
|---|
| 136 |  | 
|---|
| 137 | bool italic(const QString &family, const QString &style) const; | 
|---|
| 138 | bool bold(const QString &family, const QString &style) const; | 
|---|
| 139 | int weight(const QString &family, const QString &style) const; | 
|---|
| 140 |  | 
|---|
| 141 | static QString writingSystemName(WritingSystem writingSystem); | 
|---|
| 142 | static QString writingSystemSample(WritingSystem writingSystem); | 
|---|
| 143 |  | 
|---|
| 144 | static int addApplicationFont(const QString &fileName); | 
|---|
| 145 | static int addApplicationFontFromData(const QByteArray &fontData); | 
|---|
| 146 | static QStringList applicationFontFamilies(int id); | 
|---|
| 147 | static bool removeApplicationFont(int id); | 
|---|
| 148 | static bool removeAllApplicationFonts(); | 
|---|
| 149 |  | 
|---|
| 150 | static bool supportsThreadedFontRendering(); | 
|---|
| 151 |  | 
|---|
| 152 | private: | 
|---|
| 153 | static void createDatabase(); | 
|---|
| 154 | static void parseFontName(const QString &name, QString &foundry, QString &family); | 
|---|
| 155 | #if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) | 
|---|
| 156 | static QFontEngine *findFont(int script, const QFontPrivate *fp, const QFontDef &request); | 
|---|
| 157 | #endif | 
|---|
| 158 | static void load(const QFontPrivate *d, int script); | 
|---|
| 159 | #ifdef Q_WS_X11 | 
|---|
| 160 | static QFontEngine *loadXlfd(int screen, int script, const QFontDef &request, int force_encoding_id = -1); | 
|---|
| 161 | #endif | 
|---|
| 162 |  | 
|---|
| 163 | friend struct QFontDef; | 
|---|
| 164 | friend class QFontPrivate; | 
|---|
| 165 | friend class QFontDialog; | 
|---|
| 166 | friend class QFontDialogPrivate; | 
|---|
| 167 | friend class QFontEngineMultiXLFD; | 
|---|
| 168 | friend class QFontEngineMultiQWS; | 
|---|
| 169 | friend class QFontEngineMultiS60; | 
|---|
| 170 |  | 
|---|
| 171 | QFontDatabasePrivate *d; | 
|---|
| 172 | }; | 
|---|
| 173 |  | 
|---|
| 174 | QT_END_NAMESPACE | 
|---|
| 175 |  | 
|---|
| 176 | QT_END_HEADER | 
|---|
| 177 |  | 
|---|
| 178 | #endif // QFONTDATABASE_H | 
|---|