Remove declaration of QWindowsFontEngine::createEngine()
[profile/ivi/qtbase.git] / src / plugins / platforms / windows / qwindowsfontengine.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QWINDOWSFONTENGINE_H
43 #define QWINDOWSFONTENGINE_H
44
45 //
46 //  W A R N I N G
47 //  -------------
48 //
49 // This file is not part of the Qt API.  It exists purely as an
50 // implementation detail.  This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55
56 #include <QtGui/private/qfontengine_p.h>
57
58 #include <QtGui/QImage>
59 #include <QtCore/QSharedPointer>
60
61 #include "qtwindows_additional.h"
62
63 QT_BEGIN_NAMESPACE
64
65 class QWindowsNativeImage;
66 class QWindowsFontEngineData;
67
68 class QWindowsFontEngine : public QFontEngine
69 {
70     Q_DISABLE_COPY(QWindowsFontEngine)
71 public:
72     QWindowsFontEngine(const QString &name, HFONT, bool, LOGFONT,
73                    QSharedPointer<QWindowsFontEngineData> fontEngineData);
74
75     ~QWindowsFontEngine();
76     void initFontInfo(const QFontDef &request,
77                       HDC fontHdc,  int dpi);
78
79     virtual QFixed lineThickness() const;
80     virtual Properties properties() const;
81     virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics);
82     virtual FaceId faceId() const;
83     virtual bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
84     virtual int synthesized() const;
85     virtual QFixed emSquareSize() const;
86
87     virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
88     virtual void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const;
89
90     virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags);
91     virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
92                          QPainterPath *path, QTextItem::RenderFlags flags);
93
94     HGDIOBJ selectDesignFont() const;
95
96     virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
97     virtual glyph_metrics_t boundingBox(glyph_t g) { return boundingBox(g, QTransform()); }
98     virtual glyph_metrics_t boundingBox(glyph_t g, const QTransform &t);
99
100
101     virtual QFixed ascent() const;
102     virtual QFixed descent() const;
103     virtual QFixed leading() const;
104     virtual QFixed xHeight() const;
105     virtual QFixed averageCharWidth() const;
106     virtual qreal maxCharWidth() const;
107     virtual qreal minLeftBearing() const;
108     virtual qreal minRightBearing() const;
109
110     virtual const char *name() const;
111
112     bool canRender(const QChar *string, int len);
113
114     Type type() const;
115
116     virtual QImage alphaMapForGlyph(glyph_t t) { return alphaMapForGlyph(t, QTransform()); }
117     virtual QImage alphaMapForGlyph(glyph_t, const QTransform &xform);
118     virtual QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform);
119
120     virtual QFontEngine *cloneWithSize(qreal pixelSize) const;
121
122 #ifndef Q_CC_MINGW
123     virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0);
124 #endif
125
126     int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, bool mirrored) const;
127     void getCMap();
128
129     bool getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const;
130
131     QSharedPointer<QWindowsFontEngineData> fontEngineData() const { return m_fontEngineData; }
132     LOGFONT logfont() const { return m_logfont; }
133     void setUniqueFamilyName(const QString &newName) { uniqueFamilyName = newName; }
134
135 private:
136     QWindowsNativeImage *drawGDIGlyph(HFONT font, glyph_t, int margin, const QTransform &xform,
137                                       QImage::Format mask_format);
138
139     const QSharedPointer<QWindowsFontEngineData> m_fontEngineData;
140
141     const QString     _name;
142     QString     uniqueFamilyName;
143     const HFONT       hfont;
144     const LOGFONT     m_logfont;
145     uint        stockFont  : 1;
146     uint        ttf        : 1;
147     uint        hasOutline : 1;
148     TEXTMETRIC  tm;
149     int         lw;
150     const unsigned char *cmap;
151     QByteArray cmapTable;
152     mutable qreal lbearing;
153     mutable qreal rbearing;
154     QFixed designToDevice;
155     int unitsPerEm;
156     QFixed x_height;
157     FaceId _faceId;
158
159     mutable int synthesized_flags;
160     mutable QFixed lineWidth;
161     mutable unsigned char *widthCache;
162     mutable uint widthCacheSize;
163     mutable QFixed *designAdvances;
164     mutable int designAdvancesSize;
165 };
166
167 class QWindowsMultiFontEngine : public QFontEngineMulti
168 {
169 public:
170     QWindowsMultiFontEngine(QFontEngine *first, const QStringList &fallbacks);
171     virtual ~QWindowsMultiFontEngine();
172     void loadEngine(int at);
173
174     QStringList fallbacks;
175 };
176
177 QT_END_NAMESPACE
178
179 #endif // QWINDOWSFONTENGINE_H
180