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
qwindowsfontdatabasebase_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 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 QWINDOWSFONTDATABASEBASE_P_H
5#define QWINDOWSFONTDATABASEBASE_P_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 <qpa/qplatformfontdatabase.h>
19#include <QtGui/private/qtgui-config_p.h>
20#include <QtCore/QSharedPointer>
21#include <QtCore/QLoggingCategory>
22#include <QtCore/qt_windows.h>
23
24#if QT_CONFIG(directwrite)
25 struct IDWriteFactory;
26 struct IDWriteGdiInterop;
27 struct IDWriteFontFace;
28#endif
29
31
32#if QT_CONFIG(directwrite)
33 class QCustomFontFileLoader;
34#endif
35
37{
38 Q_DISABLE_COPY_MOVE(QWindowsFontEngineData)
39public:
42
44
45 bool clearTypeEnabled = false;
47 HDC hdc = 0;
48#if QT_CONFIG(directwrite)
49 IDWriteFactory *directWriteFactory = nullptr;
50 IDWriteGdiInterop *directWriteGdiInterop = nullptr;
51#endif
52};
53
55{
56public:
59
60 QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
61 QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
62
63 void invalidate() override;
64
65 static int defaultVerticalDPI();
66
67 static QSharedPointer<QWindowsFontEngineData> data();
68#if QT_CONFIG(directwrite)
69 static void createDirectWriteFactory(IDWriteFactory **factory);
70#endif
71 static QFont systemDefaultFont();
72 static HFONT systemFont();
73 static LOGFONT fontDefToLOGFONT(const QFontDef &fontDef, const QString &faceName);
74 static QFont LOGFONT_to_QFont(const LOGFONT& lf, int verticalDPI = 0);
75
76 static QString familyForStyleHint(QFont::StyleHint styleHint);
77 static QStringList extraTryFontsForFamily(const QString &family);
78
79 class FontTable{};
81 {
82 public:
83 EmbeddedFont(const QByteArray &fontData) : m_fontData(fontData) {}
84
85 QString changeFamilyName(const QString &newFamilyName);
86 QByteArray data() const { return m_fontData; }
87 void updateFromOS2Table(QFontEngine *fontEngine);
88 FontTable *tableDirectoryEntry(const QByteArray &tagName);
89 QString familyName(FontTable *nameTableDirectory = nullptr);
90
91 private:
92 QByteArray m_fontData;
93 };
94
95 QFontDef sanitizeRequest(QFontDef request) const;
96
97protected:
98
99#if QT_CONFIG(directwrite)
100 QList<IDWriteFontFace *> createDirectWriteFaces(const QByteArray &fontData,
101 bool queryVariations = true) const;
102 IDWriteFontFace *createDirectWriteFace(const QByteArray &fontData);
103#endif
104
105private:
106 static bool init(QSharedPointer<QWindowsFontEngineData> data);
107
108#if QT_CONFIG(directwrite)
109 mutable std::unique_ptr<QCustomFontFileLoader> m_fontFileLoader;
110#endif
111};
112
114
115#endif // QWINDOWSFONTDATABASEBASE_P_H
\inmodule QtCore
Definition qbytearray.h:57
\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
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
Static constant data shared by the font engines.
Combined button and popup list for selecting options.
GLuint64 GLenum void * handle
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLsizeiptr const void * fontData
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
unsigned int uint
Definition qtypes.h:34
double qreal
Definition qtypes.h:187
QItemEditorFactory * factory
QNetworkRequest request(url)