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