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
qwindowsfontengine_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 QWINDOWSFONTENGINE_H
5#define QWINDOWSFONTENGINE_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 <QtGui/private/qfontengine_p.h>
19
20#include <QtGui/QImage>
21#include <QtCore/QSharedPointer>
22#include <QtCore/QMetaType>
23
24#include <QtCore/qt_windows.h>
25
27
30
32{
33 Q_DISABLE_COPY_MOVE(QWindowsFontEngine)
34public:
35 QWindowsFontEngine(const QString &name, LOGFONT lf,
36 const QSharedPointer<QWindowsFontEngineData> &fontEngineData);
37
38 ~QWindowsFontEngine() override;
39 void initFontInfo(const QFontDef &request,
40 int dpi);
41
42 QFixed lineThickness() const override;
43 Properties properties() const override;
45 FaceId faceId() const override;
46 bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override;
47 int synthesized() const override;
48 QFixed emSquareSize() const override;
49
50 glyph_t glyphIndex(uint ucs4) const override;
51 int stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
52 void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const override;
53
54 void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override;
55 void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
56 QPainterPath *path, QTextItem::RenderFlags flags) override;
57
58 HGDIOBJ selectDesignFont() const;
59
62
63
64 QFixed xHeight() const override;
65 QFixed capHeight() const override;
66 QFixed averageCharWidth() const override;
67 qreal maxCharWidth() const override;
68 qreal minLeftBearing() const override;
69 qreal minRightBearing() const override;
70
74 const QFixedPoint &subPixelPosition,
75 const QTransform &xform) override;
77 const QFixedPoint &,
78 const QTransform &matrix,
79 GlyphFormat) override;
80
81 QFontEngine *cloneWithSize(qreal pixelSize) const override;
82 Qt::HANDLE handle() const override;
83 bool supportsTransformation(const QTransform &transform) const override;
84
85#ifndef Q_CC_MINGW
86 void getGlyphBearings(glyph_t glyph, qreal *leftBearing = nullptr, qreal *rightBearing = nullptr) override;
87#endif
88
89 bool hasUnreliableGlyphOutline() const override;
90
91 int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, int *mappedGlyphs) const;
92 void getCMap();
93
94 bool getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const;
95
96 const QSharedPointer<QWindowsFontEngineData> &fontEngineData() const { return m_fontEngineData; }
97
98 void setUniqueFamilyName(const QString &newName) { uniqueFamilyName = newName; }
99
100protected:
101 void initializeHeightMetrics() const override;
102
103private:
104 QWindowsNativeImage *drawGDIGlyph(HFONT font, glyph_t, int margin, const QTransform &xform,
105 QImage::Format mask_format);
106 bool hasCFFTable() const;
107 bool hasCMapTable() const;
108
109 const QSharedPointer<QWindowsFontEngineData> m_fontEngineData;
110
111 const QString _name;
112 QString uniqueFamilyName;
113 HFONT hfont = 0;
114 const LOGFONT m_logfont;
115 uint ttf : 1;
116 uint hasOutline : 1;
117 uint hasUnreliableOutline : 1;
118 uint cffTable : 1;
119 TEXTMETRIC tm;
120 const unsigned char *cmap = nullptr;
121 int cmapSize = 0;
122 QByteArray cmapTable;
123 mutable qreal lbearing = SHRT_MIN;
124 mutable qreal rbearing = SHRT_MIN;
125 QFixed designToDevice;
126 int unitsPerEm = 0;
127 QFixed x_height = -1;
128 FaceId _faceId;
129
130 mutable int synthesized_flags = -1;
131 mutable QFixed lineWidth = -1;
132 mutable unsigned char *widthCache = nullptr;
133 mutable uint widthCacheSize = 0;
134 mutable QFixed *designAdvances = nullptr;
135 mutable int designAdvancesSize = 0;
136};
137
139
140QT_DECL_METATYPE_EXTERN(HFONT, Q_GUI_EXPORT)
141QT_DECL_METATYPE_EXTERN(LOGFONT, Q_GUI_EXPORT)
142
143#endif // QWINDOWSFONTENGINE_H
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
\inmodule QtGui
Definition qimage.h:37
Format
The following image formats are available in Qt.
Definition qimage.h:41
\inmodule QtGui
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QTransform class specifies 2D transformations of a coordinate system.
Definition qtransform.h:20
Static constant data shared by the font engines.
Standard Windows font engine.
QFixed averageCharWidth() const override
bool getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const
QFixed xHeight() const override
int stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override
void setUniqueFamilyName(const QString &newName)
void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags) override
void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override
glyph_metrics_t boundingBox(glyph_t g) override
glyph_t glyphIndex(uint ucs4) const override
HGDIOBJ selectDesignFont() const
FaceId faceId() const override
const QSharedPointer< QWindowsFontEngineData > & fontEngineData() const
bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override
Returns true if the font table idetified by tag exists in the font; returns false otherwise.
void initFontInfo(const QFontDef &request, int dpi)
void initializeHeightMetrics() const override
void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const override
QFixed emSquareSize() const override
glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QFixedPoint &, const QTransform &matrix, GlyphFormat) override
qreal minLeftBearing() const override
bool hasUnreliableGlyphOutline() const override
QFontEngine * cloneWithSize(qreal pixelSize) const override
int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, int *mappedGlyphs) const
QWindowsFontEngine(const QString &name, LOGFONT lf, const QSharedPointer< QWindowsFontEngineData > &fontEngineData)
void getGlyphBearings(glyph_t glyph, qreal *leftBearing=nullptr, qreal *rightBearing=nullptr) override
QFixed capHeight() const override
QFixed lineThickness() const override
QImage alphaRGBMapForGlyph(glyph_t t, const QFixedPoint &subPixelPosition, const QTransform &xform) override
bool supportsTransformation(const QTransform &transform) const override
qreal minRightBearing() const override
QImage alphaMapForGlyph(glyph_t t) override
Qt::HANDLE handle() const override
void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override
Properties properties() const override
int synthesized() const override
qreal maxCharWidth() const override
Windows Native image.
QString str
[2]
Combined button and popup list for selecting options.
void * HANDLE
AudioChannelLayoutTag tag
static const QCssKnownValue positions[NumKnownPositionModes - 1]
#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT)
Definition qmetatype.h:1388
GLint GLint GLint GLint GLint x
[0]
GLenum GLuint GLenum GLsizei length
GLsizei GLenum const void GLuint GLsizei GLfloat * metrics
GLenum GLuint buffer
GLbitfield flags
GLboolean GLboolean g
GLuint name
GLint y
GLuint GLenum GLenum transform
GLuint GLenum matrix
GLdouble GLdouble t
Definition qopenglext.h:243
GLsizei const GLchar *const * path
GLenum GLsizei len
unsigned int glyph_t
unsigned char uchar
Definition qtypes.h:32
unsigned int uint
Definition qtypes.h:34
double qreal
Definition qtypes.h:187
QNetworkRequest request(url)