Qt 4.8
qfontdatabase.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
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 #ifdef QT3_SUPPORT
49 #include <QtCore/qstringlist.h>
50 #include <QtCore/qlist.h>
51 #endif
52 
54 
56 
57 QT_MODULE(Gui)
58 
59 class QStringList;
60 template <class T> class QList;
61 struct QFontDef;
62 class QFontEngine;
63 
65 
67 {
68  Q_GADGET
70 public:
71  // do not re-order or delete entries from this enum without updating the
72  // QPF2 format and makeqpf!!
74  Any,
75 
95  Lao,
105 
107  Other = Symbol,
108 
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  bool hasFamily(const QString &family) const;
142 
143  static QString writingSystemName(WritingSystem writingSystem);
144  static QString writingSystemSample(WritingSystem writingSystem);
145 
146  static int addApplicationFont(const QString &fileName);
147  static int addApplicationFontFromData(const QByteArray &fontData);
148  static QStringList applicationFontFamilies(int id);
149  static bool removeApplicationFont(int id);
150  static bool removeAllApplicationFonts();
151 
152  static bool supportsThreadedFontRendering();
153 
154 private:
155  static void createDatabase();
156  static void parseFontName(const QString &name, QString &foundry, QString &family);
157  static QString resolveFontFamilyAlias(const QString &family);
158 #if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN)
159  static QFontEngine *findFont(int script, const QFontPrivate *fp, const QFontDef &request);
160 #endif
161  static void load(const QFontPrivate *d, int script);
162 #ifdef Q_WS_X11
163  static QFontEngine *loadXlfd(int screen, int script, const QFontDef &request, int force_encoding_id = -1);
164 #endif
165 
166  friend struct QFontDef;
167  friend class QFontPrivate;
168  friend class QFontDialog;
169  friend class QFontDialogPrivate;
170  friend class QFontEngineMultiXLFD;
171  friend class QFontEngineMultiQWS;
172  friend class QFontEngineMultiS60;
173  friend class QFontEngineMultiQPA;
174 
176 };
177 
179 
181 
182 #endif // QFONTDATABASE_H
double d
Definition: qnumeric_p.h:62
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_MODULE(x)
Definition: qglobal.h:2783
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static bool isScalable(char **tokens)
The QString class provides a Unicode character string.
Definition: qstring.h:83
static void parseFontName(const QString &name, QString &foundry, QString &family)
This makes sense of the font family name:
#define Q_ENUMS(x)
Definition: qobjectdefs.h:84
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QFontDatabase class provides information about the fonts available in the underlying window syste...
Definition: qfontdatabase.h:66
const char * name
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59
The QFontInfo class provides general information about fonts.
Definition: qfontinfo.h:54
Q_CORE_EXPORT int QT_FASTCALL script(uint ucs4)
#define Q_GADGET
Definition: qobjectdefs.h:173
static bool isSmoothlyScalable(char **tokens)
#define load(x)
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
QFontDatabasePrivate * d
#define QT_END_HEADER
Definition: qglobal.h:137
static QString fileName(const QString &fileUrl)
static float pointSize(const QFontDef &fd, int dpi)
Definition: qfont_win.cpp:90
static bool isFixedPitch(char **tokens)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62