Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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/qfontdatabase_p.h>
24
26
28
30
31class Q_GUI_EXPORT QSupportedWritingSystems
32{
33public:
34
35 QSupportedWritingSystems();
36 QSupportedWritingSystems(const QSupportedWritingSystems &other);
37 QSupportedWritingSystems &operator=(const QSupportedWritingSystems &other);
38 ~QSupportedWritingSystems();
39
40 void setSupported(QFontDatabase::WritingSystem, bool supported = true);
41 bool supported(QFontDatabase::WritingSystem) const;
42
43private:
44 void detach();
45
46 QWritingSystemsPrivate *d;
47
48 friend Q_GUI_EXPORT bool operator==(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
49 friend Q_GUI_EXPORT bool operator!=(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
50#ifndef QT_NO_DEBUG_STREAM
51 friend Q_GUI_EXPORT QDebug operator<<(QDebug, const QSupportedWritingSystems &);
52#endif
53};
54
55Q_GUI_EXPORT bool operator==(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
56Q_GUI_EXPORT bool operator!=(const QSupportedWritingSystems &, const QSupportedWritingSystems &);
57
58#ifndef QT_NO_DEBUG_STREAM
59Q_GUI_EXPORT QDebug operator<<(QDebug, const QSupportedWritingSystems &);
60#endif
61
62class QFontRequestPrivate;
63class QFontEngineMulti;
64
65class Q_GUI_EXPORT QPlatformFontDatabase
66{
67public:
68 virtual ~QPlatformFontDatabase();
69 virtual void populateFontDatabase();
70 virtual bool populateFamilyAliases(const QString &missingFamily) { Q_UNUSED(missingFamily); return false; }
71 virtual void populateFamily(const QString &familyName);
72 virtual void invalidate();
73
74 virtual QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QFontDatabasePrivate::ExtendedScript script) const;
75 virtual QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *font = nullptr);
76
77 virtual QFontEngine *fontEngine(const QFontDef &fontDef, void *handle);
78 virtual QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference);
79 virtual QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QFontDatabasePrivate::ExtendedScript script);
80 virtual void releaseHandle(void *handle);
81
82 virtual QString fontDir() const;
83
84 virtual QFont defaultFont() const;
85 virtual bool isPrivateFontFamily(const QString &family) const;
86
87 virtual QString resolveFontFamilyAlias(const QString &family) const;
88 virtual bool fontsAlwaysScalable() const;
89 virtual QList<int> standardSizes() const;
90
91 virtual bool supportsVariableApplicationFonts() const;
92 virtual bool supportsColrv0Fonts() 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, bool colorFont,
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
113QT_END_NAMESPACE
114
115#endif // QPLATFORMFONTDATABASE_H
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
Definition qbytearray.h:801
friend bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are different, otherwise returns false.
Definition qbytearray.h:812
The QPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they ...
The QSupportedWritingSystems class is used when registering fonts with the internal Qt fontdatabase.
QWritingSystemsPrivate(const QWritingSystemsPrivate *other)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2568
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
void qt_registerFont(const QString &familyName, const QString &stylename, const QString &foundryname, int weight, QFont::Style style, int stretch, bool antialiased, bool scalable, int pixelSize, bool fixedPitch, bool colorFont, const QSupportedWritingSystems &writingSystems, void *handle)
bool qt_isFontFamilyPopulated(const QString &familyName)
void qt_registerFontFamily(const QString &familyName)
void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias)
QString qt_resolveFontFamilyAlias(const QString &alias)
static const quint8 requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2]
@ SimplifiedChineseCsbBit
@ CentralEuropeCsbBit
@ TraditionalChineseCsbBit
QT_BEGIN_NAMESPACE QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY(lcAotCompiler, Q_QMLCOMPILER_EXPORT)