Qt 6.x
The Qt SDK
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
33{
34 Q_DISABLE_COPY_MOVE(QWindowsFontEngineData)
35public:
38
40
41 bool clearTypeEnabled = false;
43 HDC hdc = 0;
44#if QT_CONFIG(directwrite)
45 IDWriteFactory *directWriteFactory = nullptr;
46 IDWriteGdiInterop *directWriteGdiInterop = nullptr;
47#endif
48};
49
51{
52public:
55
56 QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
57 QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
58
59 static int defaultVerticalDPI();
60
62#if QT_CONFIG(directwrite)
63 static void createDirectWriteFactory(IDWriteFactory **factory);
64#endif
65 static QFont systemDefaultFont();
66 static HFONT systemFont();
67 static LOGFONT fontDefToLOGFONT(const QFontDef &fontDef, const QString &faceName);
68 static QFont LOGFONT_to_QFont(const LOGFONT& lf, int verticalDPI = 0);
69
70 static QString familyForStyleHint(QFont::StyleHint styleHint);
71 static QStringList extraTryFontsForFamily(const QString &family);
72
73 class FontTable{};
75 {
76 public:
77 EmbeddedFont(const QByteArray &fontData) : m_fontData(fontData) {}
78
79 QString changeFamilyName(const QString &newFamilyName);
80 QByteArray data() const { return m_fontData; }
81 void updateFromOS2Table(QFontEngine *fontEngine);
82 FontTable *tableDirectoryEntry(const QByteArray &tagName);
83 QString familyName(FontTable *nameTableDirectory = nullptr);
84
85 private:
86 QByteArray m_fontData;
87 };
88
89 QFontDef sanitizeRequest(QFontDef request) const;
90
91protected:
92
93#if QT_CONFIG(directwrite)
94 IDWriteFontFace *createDirectWriteFace(const QByteArray &fontData) const;
95#endif
96
97private:
99};
100
102
103#endif // QWINDOWSFONTDATABASEBASE_P_H
\inmodule QtCore
Definition qbytearray.h:57
\reentrant
Definition qfont.h:20
StyleHint
Style hints are used by the \l{QFont}{font matching} algorithm to find an appropriate default family ...
Definition qfont.h:23
HintingPreference
Definition qfont.h:52
The QPlatformFontDatabase class makes it possible to customize how fonts are discovered and how they ...
virtual QFontEngine * fontEngine(const QFontDef &fontDef, void *handle)
Returns the font engine that can be used to render the font described by the font definition,...
\inmodule QtCore
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
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:29
double qreal
Definition qtypes.h:92
QItemEditorFactory * factory
QNetworkRequest request(url)