1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtGui module of the Qt Toolkit.
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.
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.
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.
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.
40 ****************************************************************************/
42 #ifndef QFONTDATABASE_H
43 #define QFONTDATABASE_H
45 #include <QtGui/qwindowdefs.h>
46 #include <QtCore/qstring.h>
47 #include <QtGui/qfont.h>
55 template <class T> class QList;
59 class QFontDatabasePrivate;
61 class Q_GUI_EXPORT QFontDatabase
64 Q_ENUMS(WritingSystem)
66 // do not re-order or delete entries from this enum without updating the
67 // QPF2 format and makeqpf!!
111 static QList<int> standardSizes();
115 QList<WritingSystem> writingSystems() const;
116 QList<WritingSystem> writingSystems(const QString &family) const;
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);
125 QFont font(const QString &family, const QString &style, int pointSize) const;
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;
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;
136 bool hasFamily(const QString &family) const;
138 static QString writingSystemName(WritingSystem writingSystem);
139 static QString writingSystemSample(WritingSystem writingSystem);
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();
147 static bool supportsThreadedFontRendering();
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);
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;
164 QFontDatabasePrivate *d;
171 #endif // QFONTDATABASE_H