1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QFONTDATABASE_H
5#define QFONTDATABASE_H
6
7#include <QtGui/qtguiglobal.h>
8#include <QtGui/qwindowdefs.h>
9#include <QtCore/qstring.h>
10#include <QtGui/qfont.h>
11
12QT_BEGIN_NAMESPACE
13
14
15struct QFontDef;
16class QFontEngine;
17
18class Q_GUI_EXPORT QFontDatabase
19{
20 Q_GADGET
21public:
22 enum WritingSystem {
23 Any,
24
25 Latin,
26 Greek,
27 Cyrillic,
28 Armenian,
29 Hebrew,
30 Arabic,
31 Syriac,
32 Thaana,
33 Devanagari,
34 Bengali,
35 Gurmukhi,
36 Gujarati,
37 Oriya,
38 Tamil,
39 Telugu,
40 Kannada,
41 Malayalam,
42 Sinhala,
43 Thai,
44 Lao,
45 Tibetan,
46 Myanmar,
47 Georgian,
48 Khmer,
49 SimplifiedChinese,
50 TraditionalChinese,
51 Japanese,
52 Korean,
53 Vietnamese,
54
55 Symbol,
56 Other = Symbol,
57
58 Ogham,
59 Runic,
60 Nko,
61
62 WritingSystemsCount
63 };
64 Q_ENUM(WritingSystem)
65
66 enum SystemFont {
67 GeneralFont,
68 FixedFont,
69 TitleFont,
70 SmallestReadableFont
71 };
72 Q_ENUM(SystemFont)
73
74 static QList<int> standardSizes();
75
76#if QT_DEPRECATED_SINCE(6, 0) && !defined(QT_BUILD_GUI_LIB)
77 QT_DEPRECATED_VERSION_X_6_0("Call the static functions instead") explicit QFontDatabase() = default;
78#else
79 QFontDatabase() = delete;
80#endif
81
82 static QList<WritingSystem> writingSystems();
83 static QList<WritingSystem> writingSystems(const QString &family);
84
85 static QStringList families(WritingSystem writingSystem = Any);
86 static QStringList styles(const QString &family);
87 static QList<int> pointSizes(const QString &family, const QString &style = QString());
88 static QList<int> smoothSizes(const QString &family, const QString &style);
89 static QString styleString(const QFont &font);
90 static QString styleString(const QFontInfo &fontInfo);
91
92 static QFont font(const QString &family, const QString &style, int pointSize);
93
94 static bool isBitmapScalable(const QString &family, const QString &style = QString());
95 static bool isSmoothlyScalable(const QString &family, const QString &style = QString());
96 static bool isScalable(const QString &family, const QString &style = QString());
97 static bool isFixedPitch(const QString &family, const QString &style = QString());
98
99 static bool italic(const QString &family, const QString &style);
100 static bool bold(const QString &family, const QString &style);
101 static int weight(const QString &family, const QString &style);
102
103 static bool hasFamily(const QString &family);
104 static bool isPrivateFamily(const QString &family);
105
106 static QString writingSystemName(WritingSystem writingSystem);
107 static QString writingSystemSample(WritingSystem writingSystem);
108
109 static int addApplicationFont(const QString &fileName);
110 static int addApplicationFontFromData(const QByteArray &fontData);
111 static QStringList applicationFontFamilies(int id);
112 static bool removeApplicationFont(int id);
113 static bool removeAllApplicationFonts();
114
115 static QFont systemFont(SystemFont type);
116};
117
118QT_END_NAMESPACE
119
120#endif // QFONTDATABASE_H
121

source code of qtbase/src/gui/text/qfontdatabase.h