Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qplatformfontdatabase.h
Go to the documentation of this file.
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 QPLATFORMFONTDATABASE_H
5#define QPLATFORMFONTDATABASE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is part of the QPA API and is not meant to be used
12// in applications. Usage of this API may make your code
13// source and binary incompatible with future versions of Qt.
14//
15
16#include <QtGui/qtguiglobal.h>
17#include <QtCore/qloggingcategory.h>
18#include <QtCore/QString>
19#include <QtCore/QStringList>
20#include <QtCore/QList>
21#include <QtGui/QFontDatabase>
22#include <QtGui/private/qfontengine_p.h>
23#include <QtGui/private/qfont_p.h>
24#include <QtGui/private/qfontdatabase_p.h>
25
27
28Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcQpaFonts, Q_GUI_EXPORT)
29
31
32class Q_GUI_EXPORT QSupportedWritingSystems
33{
34public:
35
40
41 void setSupported(QFontDatabase::WritingSystem, bool supported = true);
42 bool supported(QFontDatabase::WritingSystem) const;
43
44private:
45 void detach();
46
48
49 friend Q_GUI_EXPORT bool operator==(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
50 friend Q_GUI_EXPORT bool operator!=(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
51#ifndef QT_NO_DEBUG_STREAM
52 friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QSupportedWritingSystems &);
53#endif
54};
55
56Q_GUI_EXPORT bool operator==(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
57Q_GUI_EXPORT bool operator!=(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
58
59#ifndef QT_NO_DEBUG_STREAM
61#endif
62
63class QFontRequestPrivate;
65
66class Q_GUI_EXPORT QPlatformFontDatabase
67{
68public:
69 virtual ~QPlatformFontDatabase();
70 virtual void populateFontDatabase();
71 virtual bool populateFamilyAliases(const QString &missingFamily) { Q_UNUSED(missingFamily); return false; }
72 virtual void populateFamily(const QString &familyName);
73 virtual void invalidate();
74
75 virtual QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const;
76 virtual QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *font = nullptr);
77
78 virtual QFontEngine *fontEngine(const QFontDef &fontDef, void *handle);
79 virtual QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference);
80 virtual QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script);
81 virtual void releaseHandle(void *handle);
82
83 virtual QString fontDir() const;
84
85 virtual QFont defaultFont() const;
86 virtual bool isPrivateFontFamily(const QString &family) const;
87
88 virtual QString resolveFontFamilyAlias(const QString &family) const;
89 virtual bool fontsAlwaysScalable() const;
90 virtual QList<int> standardSizes() const;
91
92 virtual bool supportsVariableApplicationFonts() const;
93
94 // helper
95 static QSupportedWritingSystems writingSystemsFromTrueTypeBits(quint32 unicodeRange[4], quint32 codePageRange[2]);
96 static QSupportedWritingSystems writingSystemsFromOS2Table(const char *os2Table, size_t length);
97
98 //callback
99 static void registerFont(const QString &familyname, const QString &stylename,
100 const QString &foundryname, QFont::Weight weight,
101 QFont::Style style, QFont::Stretch stretch, bool antialiased,
102 bool scalable, int pixelSize, bool fixedPitch,
103 const QSupportedWritingSystems &writingSystems, void *handle);
104
105 static void registerFontFamily(const QString &familyName);
106 static void registerAliasToFontFamily(const QString &familyName, const QString &alias);
107
108 static void repopulateFontDatabase();
109
110 static bool isFamilyPopulated(const QString &familyName);
111};
112
114
115#endif // QPLATFORMFONTDATABASE_H
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
WritingSystem
\value Any \value Latin \value Greek \value Cyrillic \value Armenian \value Hebrew \value Arabic \val...
\reentrant
Definition qfont.h:22
StyleHint
Style hints are used by the \l{QFont}{font matching} algorithm to find an appropriate default family ...
Definition qfont.h:25
HintingPreference
Definition qfont.h:55
Stretch
Predefined stretch values that follow the CSS naming convention.
Definition qfont.h:83
Weight
Qt uses a weighting scale from 1 to 1000 compatible with OpenType.
Definition qfont.h:63
Style
This enum describes the different styles of glyphs that are used to display text.
Definition qfont.h:76
The QPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they ...
virtual bool populateFamilyAliases(const QString &missingFamily)
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QSupportedWritingSystems class is used when registering fonts with the internal Qt fontdatabase.
Combined button and popup list for selecting options.
constexpr bool operator!=(const timespec &t1, const timespec &t2)
static QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
#define Q_DECLARE_EXPORTED_LOGGING_CATEGORY(name, export_macro)
GLuint64 GLenum void * handle
GLenum GLuint GLenum GLsizei length
GLuint GLuint GLfloat weight
GLenum GLsizeiptr const void * fontData
Q_GUI_EXPORT bool operator!=(const QSupportedWritingSystems &, const QSupportedWritingSystems &)
Q_GUI_EXPORT QDebug operator<<(QDebug, const QSupportedWritingSystems &)
Q_GUI_EXPORT bool operator==(const QSupportedWritingSystems &, const QSupportedWritingSystems &)
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
#define Q_UNUSED(x)
unsigned int quint32
Definition qtypes.h:50
double qreal
Definition qtypes.h:187
QDataStream & operator<<(QDataStream &out, const MyClass &myObj)
[4]
QSharedPointer< T > other(t)
[5]