Compile with clang when C++11 support is enabled
[profile/ivi/qtbase.git] / src / gui / text / qfontdatabase.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
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
49 QT_BEGIN_HEADER
50
51 QT_BEGIN_NAMESPACE
52
53
54 class QStringList;
55 template <class T> class QList;
56 struct QFontDef;
57 class QFontEngine;
58
59 class QFontDatabasePrivate;
60
61 class Q_GUI_EXPORT QFontDatabase
62 {
63     Q_GADGET
64     Q_ENUMS(WritingSystem)
65 public:
66     // do not re-order or delete entries from this enum without updating the
67     // QPF2 format and makeqpf!!
68     enum WritingSystem {
69         Any,
70
71         Latin,
72         Greek,
73         Cyrillic,
74         Armenian,
75         Hebrew,
76         Arabic,
77         Syriac,
78         Thaana,
79         Devanagari,
80         Bengali,
81         Gurmukhi,
82         Gujarati,
83         Oriya,
84         Tamil,
85         Telugu,
86         Kannada,
87         Malayalam,
88         Sinhala,
89         Thai,
90         Lao,
91         Tibetan,
92         Myanmar,
93         Georgian,
94         Khmer,
95         SimplifiedChinese,
96         TraditionalChinese,
97         Japanese,
98         Korean,
99         Vietnamese,
100
101         Symbol,
102         Other = Symbol,
103
104         Ogham,
105         Runic,
106         Nko,
107
108         WritingSystemsCount
109     };
110
111     static QList<int> standardSizes();
112
113     QFontDatabase();
114
115     QList<WritingSystem> writingSystems() const;
116     QList<WritingSystem> writingSystems(const QString &family) const;
117
118     QStringList families(WritingSystem writingSystem = Any) const;
119     QStringList styles(const QString &family) const;
120     QList<int> pointSizes(const QString &family, const QString &style = QString());
121     QList<int> smoothSizes(const QString &family, const QString &style);
122     QString styleString(const QFont &font);
123     QString styleString(const QFontInfo &fontInfo);
124
125     QFont font(const QString &family, const QString &style, int pointSize) const;
126
127     bool isBitmapScalable(const QString &family, const QString &style = QString()) const;
128     bool isSmoothlyScalable(const QString &family, const QString &style = QString()) const;
129     bool isScalable(const QString &family, const QString &style = QString()) const;
130     bool isFixedPitch(const QString &family, const QString &style = QString()) const;
131
132     bool italic(const QString &family, const QString &style) const;
133     bool bold(const QString &family, const QString &style) const;
134     int weight(const QString &family, const QString &style) const;
135
136     bool hasFamily(const QString &family) const;
137
138     static QString writingSystemName(WritingSystem writingSystem);
139     static QString writingSystemSample(WritingSystem writingSystem);
140
141     static int addApplicationFont(const QString &fileName);
142     static int addApplicationFontFromData(const QByteArray &fontData);
143     static QStringList applicationFontFamilies(int id);
144     static bool removeApplicationFont(int id);
145     static bool removeAllApplicationFonts();
146
147     static bool supportsThreadedFontRendering();
148
149 private:
150     static void createDatabase();
151     static void parseFontName(const QString &name, QString &foundry, QString &family);
152     static QString resolveFontFamilyAlias(const QString &family);
153     static QFontEngine *findFont(int script, const QFontPrivate *fp, const QFontDef &request, bool multi = false);
154     static void load(const QFontPrivate *d, int script);
155
156     friend struct QFontDef;
157     friend class QFontPrivate;
158     friend class QFontDialog;
159     friend class QFontDialogPrivate;
160     friend class QFontEngineMultiXLFD;
161     friend class QFontEngineMultiQWS;
162     friend class QFontEngineMultiQPA;
163
164     QFontDatabasePrivate *d;
165 };
166
167 QT_END_NAMESPACE
168
169 QT_END_HEADER
170
171 #endif // QFONTDATABASE_H