Qt 4.8
qabstractfontengine_qws.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QABSTRACTFONTENGINE_QWS_H
43 #define QABSTRACTFONTENGINE_QWS_H
44 
45 #include <QtCore/qobject.h>
46 #include <QtCore/qhash.h>
47 #include <QtCore/qvariant.h>
48 #include <QtCore/qfactoryinterface.h>
49 #include <QtGui/qpaintengine.h>
50 #include <QtGui/qfontdatabase.h>
51 
53 
55 
56 QT_MODULE(Gui)
57 
59 
61 {
62 public:
63  QDOC_PROPERTY(QString family READ family WRITE setFamily)
64  QDOC_PROPERTY(qreal pixelSize READ pixelSize WRITE setPixelSize)
65  QDOC_PROPERTY(int weight READ weight WRITE setWeight)
66  QDOC_PROPERTY(QFont::Style style READ style WRITE setStyle)
67  QDOC_PROPERTY(QList<QFontDatabase::WritingSystem> writingSystems READ writingSystems WRITE setWritingSystems)
68 
70  explicit QFontEngineInfo(const QString &family);
71  QFontEngineInfo(const QFontEngineInfo &other);
72  QFontEngineInfo &operator=(const QFontEngineInfo &other);
73  ~QFontEngineInfo();
74 
75  void setFamily(const QString &name);
76  QString family() const;
77 
78  void setPixelSize(qreal size);
79  qreal pixelSize() const;
80 
81  void setWeight(int weight);
82  int weight() const;
83 
84  void setStyle(QFont::Style style);
85  QFont::Style style() const;
86 
87  QList<QFontDatabase::WritingSystem> writingSystems() const;
88  void setWritingSystems(const QList<QFontDatabase::WritingSystem> &writingSystems);
89 
90 private:
92 };
93 
95 
97 {
98  virtual QAbstractFontEngine *create(const QFontEngineInfo &info) = 0;
99  virtual QList<QFontEngineInfo> availableFontEngines() const = 0;
100 };
101 
102 #define QFontEngineFactoryInterface_iid "com.trolltech.Qt.QFontEngineFactoryInterface"
104 
106 
108 {
109  Q_OBJECT
111 public:
112  QFontEnginePlugin(const QString &foundry, QObject *parent = 0);
114 
115  virtual QStringList keys() const;
116 
117  virtual QAbstractFontEngine *create(const QFontEngineInfo &info) = 0;
118  virtual QList<QFontEngineInfo> availableFontEngines() const = 0;
119 
120 private:
123 };
124 
126 
128 {
129  Q_OBJECT
130 public:
131  enum Capability {
132  CanOutlineGlyphs = 1,
133  CanRenderGlyphs_Mono = 2,
134  CanRenderGlyphs_Gray = 4,
135  CanRenderGlyphs = CanRenderGlyphs_Mono | CanRenderGlyphs_Gray
136  };
137  Q_DECLARE_FLAGS(Capabilities, Capability)
138 
139  explicit QAbstractFontEngine(QObject *parent = 0);
141 
142  typedef int Fixed; // 26.6
143 
144  struct FixedPoint
145  {
146  Fixed x;
147  Fixed y;
148  };
149 
151  {
152  inline GlyphMetrics()
153  : x(0), y(0), width(0), height(0),
154  advance(0) {}
155  Fixed x;
156  Fixed y;
157  Fixed width;
158  Fixed height;
159  Fixed advance;
160  };
161 
174 
175  // hints
177  OutlineGlyphsHint
178  };
179 
180  // keep in sync with QTextEngine::ShaperFlag!!
182  RightToLeft = 0x0001,
183  ReturnDesignMetrics = 0x0002
184  };
185  Q_DECLARE_FLAGS(TextShapingFlags, TextShapingFlag)
186 
187  virtual Capabilities capabilities() const = 0;
188  virtual QVariant fontProperty(FontProperty property) const = 0;
189 
190  virtual bool convertStringToGlyphIndices(const QChar *string, int length, uint *glyphs, int *numGlyphs, TextShapingFlags flags) const = 0;
191 
192  virtual void getGlyphAdvances(const uint *glyphs, int numGlyphs, Fixed *advances, TextShapingFlags flags) const = 0;
193 
194  virtual GlyphMetrics glyphMetrics(uint glyph) const = 0;
195 
196  virtual bool renderGlyph(uint glyph, int depth, int bytesPerLine, int height, uchar *buffer);
197 
198  virtual void addGlyphOutlinesToPath(uint *glyphs, int numGlyphs, FixedPoint *positions, QPainterPath *path);
199 
200  /*
201  enum Extension {
202  GetTrueTypeTable
203  };
204 
205  virtual bool supportsExtension(Extension extension) const;
206  virtual QVariant extension(Extension extension, const QVariant &argument = QVariant());
207  */
208 
209 private:
212 };
213 
214 Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractFontEngine::Capabilities)
215 Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractFontEngine::TextShapingFlags)
216 
218 
220 
221 #endif
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
#define QFontEngineFactoryInterface_iid
double qreal
Definition: qglobal.h:1193
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QDOC_PROPERTY(text)
Definition: qglobal.h:2503
#define QT_MODULE(x)
Definition: qglobal.h:2783
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
Definition: qglobal.h:2348
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
Fixed y
The y coordinate of this point.
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
virtual QList< QFontEngineInfo > availableFontEngines() const =0
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
The QString class provides a Unicode character string.
Definition: qstring.h:83
Fixed advance
The advance of the glyph.
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
virtual QAbstractFontEngine * create(const QFontEngineInfo &info)=0
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
Capability
This enum describes the capabilities of a font engine.
#define Q_DECLARE_INTERFACE(IFace, IId)
Definition: qobject.h:397
The QFontEnginePlugin class is the base class for font engine factory plugins in Qt for Embedded Linu...
unsigned char uchar
Definition: qglobal.h:994
QAbstractFontEngine::FixedPoint defines a point in the place using 26.6 fixed point precision...
TextShapingFlag
This enum describes flags controlling conversion of characters to glyphs and their metrics...
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
Definition: qglobal.h:2355
static float pixelSize(const QFontDef &request, int dpi)
Definition: qfont_win.cpp:80
int Fixed
This type is int, interpreted as a 26.
The QFontEngineInfo class describes a specific font provided by a font engine plugin.
static const QCssKnownValue positions[NumKnownPositionModes - 1]
Definition: qcssparser.cpp:329
const char * name
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
unsigned int uint
Definition: qglobal.h:996
Style
This enum describes the different styles of glyphs that are used to display text. ...
Definition: qfont.h:111
#define Q_OBJECT
Definition: qobjectdefs.h:157
Fixed height
The height of the glyph.
GlyphMetrics()
Constructs an empty glyph metrics object with all values set to zero.
virtual QStringList keys() const =0
Fixed x
The x coordinate of this point.
QAbstractFontEngine::GlyphMetrics defines the metrics of a single glyph.
QFontEngineInfoPrivate * d
#define Q_INTERFACES(x)
This macro tells Qt which interfaces the class implements.
Definition: qobjectdefs.h:79
Fixed width
The width of the glyph.
const char * property
Definition: qwizard.cpp:138
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
#define QT_END_HEADER
Definition: qglobal.h:137
FontProperty
This enum describes the properties of a font provided by a font engine.
The QAbstractFontEngine class is the base class for font engine plugins in Qt for Embedded Linux...
Fixed x
The horizontal offset from the origin.
Fixed y
The vertical offset from the origin (baseline).