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
qcoretextfontdatabase_p.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 QCORETEXTFONTDATABASE_H
5#define QCORETEXTFONTDATABASE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <qglobal.h>
19
20#include <qpa/qplatformfontdatabase.h>
21#include <qpa/qplatformtheme.h>
22#include <private/qcore_mac_p.h>
23
24Q_FORWARD_DECLARE_CF_TYPE(CTFontDescriptor);
26
27QT_DECL_METATYPE_EXTERN_TAGGED(QCFType<CGFontRef>, QCFType_CGFontRef, Q_GUI_EXPORT)
28QT_DECL_METATYPE_EXTERN_TAGGED(QCFType<CFURLRef>, QCFType_CFURLRef, Q_GUI_EXPORT)
29
31
33{
34public:
37 void populateFontDatabase() override;
38 bool populateFamilyAliases(const QString &missingFamily) override;
39 void populateFamily(const QString &familyName) override;
40 void invalidate() override;
41
42 QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override;
43 QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont = nullptr) override;
44 void releaseHandle(void *handle) override;
45 bool isPrivateFontFamily(const QString &family) const override;
46 QFont defaultFont() const override;
47 bool fontsAlwaysScalable() const override;
48 QList<int> standardSizes() const override;
49 bool supportsVariableApplicationFonts() const override;
50
51 // For iOS and macOS platform themes
52 QFont *themeFont(QPlatformTheme::Font) const;
53
54private:
55 void populateThemeFonts();
56 void populateFromDescriptor(CTFontDescriptorRef font, const QString &familyName = QString(), QFontDatabasePrivate::ApplicationFont *applicationFont = nullptr);
57 static CFArrayRef fallbacksForFamily(const QString &family);
58
59 QHash<QPlatformTheme::Font, QFont *> m_themeFonts;
60 QHash<QString, QList<QCFType<CTFontDescriptorRef>>> m_systemFontDescriptors;
61 QHash<QChar::Script, QString> m_hardcodedFallbackFonts;
62 mutable QSet<QString> m_privateFamilies;
63
64 bool m_hasPopulatedAliases;
65
66#if defined(Q_OS_MACOS)
67 QMacNotificationObserver m_fontSetObserver;
68#endif
69};
70
71// Split out into separate template class so that the compiler doesn't have
72// to generate code for each override in QCoreTextFontDatabase for each T.
73
74template <class T>
76{
77public:
78 QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
79 QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
80};
81
83
84#endif // QCORETEXTFONTDATABASE_H
\inmodule QtCore
Definition qbytearray.h:57
QFontEngine * fontEngine(const QFontDef &fontDef, void *handle) override
Returns the font engine that can be used to render the font described by the font definition,...
\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
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 ...
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
#define Q_FORWARD_DECLARE_CF_TYPE(type)
static QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
#define QT_DECL_METATYPE_EXTERN_TAGGED(TYPE, TAG, EXPORT)
Definition qmetatype.h:1376
GLuint64 GLenum void * handle
GLenum GLsizeiptr const void * fontData
double qreal
Definition qtypes.h:187