- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# qabstractfontengine_qws.h

Go to the documentation of this file.

    00001 /****************************************************************************
    00002 **
    00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    00004 ** All rights reserved.
    00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
    00006 **
    00007 ** This file is part of the QtGui module of the Qt Toolkit.
    00008 **
    00009 ** $QT_BEGIN_LICENSE:LGPL$
    00010 ** Commercial Usage
    00011 ** Licensees holding valid Qt Commercial licenses may use this file in
    00012 ** accordance with the Qt Commercial License Agreement provided with the
    00013 ** Software or, alternatively, in accordance with the terms contained in
    00014 ** a written agreement between you and Nokia.
    00015 **
    00016 ** GNU Lesser General Public License Usage
    00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
    00018 ** General Public License version 2.1 as published by the Free Software
    00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
    00020 ** packaging of this file.  Please review the following information to
    00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
    00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    00023 **
    00024 ** In addition, as a special exception, Nokia gives you certain additional
    00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
    00027 **
    00028 ** GNU General Public License Usage
    00029 ** Alternatively, this file may be used under the terms of the GNU
    00030 ** General Public License version 3.0 as published by the Free Software
    00031 ** Foundation and appearing in the file LICENSE.GPL included in the
    00032 ** packaging of this file.  Please review the following information to
    00033 ** ensure the GNU General Public License version 3.0 requirements will be
    00034 ** met: http://www.gnu.org/copyleft/gpl.html.
    00035 **
    00036 ** If you have questions regarding the use of this file, please contact
    00037 ** Nokia at qt-info@nokia.com.
    00038 ** $QT_END_LICENSE$
    00039 **
    00040 ****************************************************************************/
    00041
    00042 #ifndef QABSTRACTFONTENGINE_QWS_H
    00043 #define QABSTRACTFONTENGINE_QWS_H
    00044
    00045 #include <QtCore/qobject.h>
    00046 #include <QtCore/qhash.h>
    00047 #include <QtCore/qvariant.h>
    00048 #include <QtCore/qfactoryinterface.h>
    00049 #include <QtGui/qpaintengine.h>
    00050 #include <QtGui/qfontdatabase.h>
    00051
    00052 QT_BEGIN_HEADER
    00053
    00054 QT_BEGIN_NAMESPACE
    00055
    00056 QT_MODULE(Gui)
    00057
    00058 class QFontEngineInfoPrivate;
    00059
    00060 class Q_GUI_EXPORT QFontEngineInfo
    00061 {
    00062 public:
    00063     QDOC_PROPERTY(QString family READ family WRITE setFamily)
    00064     QDOC_PROPERTY(qreal pixelSize READ pixelSize WRITE setPixelSize)
    00065     QDOC_PROPERTY(int weight READ weight WRITE setWeight)
    00066     QDOC_PROPERTY(QFont::Style style READ style WRITE setStyle)
    00067     QDOC_PROPERTY(QList<QFontDatabase::WritingSystem> writingSystems READ writingSystems WRITE setWritingSystems)
    00068
    00069     QFontEngineInfo();
    00070     explicit QFontEngineInfo(const QString &family);
    00071     QFontEngineInfo(const QFontEngineInfo &other);
    00072     QFontEngineInfo &operator=(const QFontEngineInfo &other);
    00073     ~QFontEngineInfo();
    00074
    00075     void setFamily(const QString &name);
    00076     QString family() const;
    00077
    00078     void setPixelSize(qreal size);
    00079     qreal pixelSize() const;
    00080
    00081     void setWeight(int weight);
    00082     int weight() const;
    00083
    00084     void setStyle(QFont::Style style);
    00085     QFont::Style style() const;
    00086
    00087     QList<QFontDatabase::WritingSystem> writingSystems() const;
    00088     void setWritingSystems(const QList<QFontDatabase::WritingSystem> &writingSystems);
    00089
    00090 private:
    00091     QFontEngineInfoPrivate *d;
    00092 };
    00093
    00094 class QAbstractFontEngine;
    00095
    00096 struct Q_GUI_EXPORT QFontEngineFactoryInterface : public QFactoryInterface
    00097 {
    00098      virtual QAbstractFontEngine *create(const QFontEngineInfo &info) = 0;
    00099      virtual QList<QFontEngineInfo> availableFontEngines() const = 0;
    00100 };
    00101
    00102 #define QFontEngineFactoryInterface_iid "com.trolltech.Qt.QFontEngineFactoryInterface"
    00103 Q_DECLARE_INTERFACE(QFontEngineFactoryInterface, QFontEngineFactoryInterface_iid)
    00104
    00105 class QFontEnginePluginPrivate;
    00106
    00107 class Q_GUI_EXPORT QFontEnginePlugin : public QObject, public QFontEngineFactoryInterface
    00108 {
    00109     Q_OBJECT
    00110     Q_INTERFACES(QFontEngineFactoryInterface:QFactoryInterface)
    00111 public:
    00112     QFontEnginePlugin(const QString &foundry, QObject *parent = 0);
    00113     ~QFontEnginePlugin();
    00114
    00115     virtual QStringList keys() const;
    00116
    00117     virtual QAbstractFontEngine *create(const QFontEngineInfo &info) = 0;
    00118     virtual QList<QFontEngineInfo> availableFontEngines() const = 0;
    00119
    00120 private:
    00121     Q_DECLARE_PRIVATE(QFontEnginePlugin)
    00122     Q_DISABLE_COPY(QFontEnginePlugin)
    00123 };
    00124
    00125 class QAbstractFontEnginePrivate;
    00126
    00127 class Q_GUI_EXPORT QAbstractFontEngine : public QObject
    00128 {
    00129     Q_OBJECT
    00130 public:
    00131     enum Capability {
    00132         CanOutlineGlyphs = 1,
    00133         CanRenderGlyphs_Mono = 2,
    00134         CanRenderGlyphs_Gray = 4,
    00135         CanRenderGlyphs = CanRenderGlyphs_Mono | CanRenderGlyphs_Gray
    00136     };
    00137     Q_DECLARE_FLAGS(Capabilities, Capability)
    00138
    00139     explicit QAbstractFontEngine(QObject *parent = 0);
    00140     ~QAbstractFontEngine();
    00141
    00142     typedef int Fixed; // 26.6
    00143
    00144     struct FixedPoint
    00145     {
    00146         Fixed x;
    00147         Fixed y;
    00148     };
    00149
    00150     struct GlyphMetrics
    00151     {
    00152         inline GlyphMetrics()
    00153             : x(0), y(0), width(0), height(0),
    00154               advance(0) {}
    00155         Fixed x;
    00156         Fixed y;
    00157         Fixed width;
    00158         Fixed height;
    00159         Fixed advance;
    00160     };
    00161
    00162     enum FontProperty {
    00163         Ascent,
    00164         Descent,
    00165         Leading,
    00166         XHeight,
    00167         AverageCharWidth,
    00168         LineThickness,
    00169         UnderlinePosition,
    00170         MaxCharWidth,
    00171         MinLeftBearing,
    00172         MinRightBearing,
    00173         GlyphCount,
    00174
    00175         // hints
    00176         CacheGlyphsHint,
    00177         OutlineGlyphsHint
    00178     };
    00179
    00180     // keep in sync with QTextEngine::ShaperFlag!!
    00181     enum TextShapingFlag {
    00182         RightToLeft         = 0x0001,
    00183         ReturnDesignMetrics = 0x0002
    00184     };
    00185     Q_DECLARE_FLAGS(TextShapingFlags, TextShapingFlag)
    00186
    00187     virtual Capabilities capabilities() const = 0;
    00188     virtual QVariant fontProperty(FontProperty property) const = 0;
    00189
    00190     virtual bool convertStringToGlyphIndices(const QChar *string, int length, uint *glyphs, int *numGlyphs, TextShapingFlags flags) const = 0;
    00191
    00192     virtual void getGlyphAdvances(const uint *glyphs, int numGlyphs, Fixed *advances, TextShapingFlags flags) const = 0;
    00193
    00194     virtual GlyphMetrics glyphMetrics(uint glyph) const = 0;
    00195
    00196     virtual bool renderGlyph(uint glyph, int depth, int bytesPerLine, int height, uchar *buffer);
    00197
    00198     virtual void addGlyphOutlinesToPath(uint *glyphs, int numGlyphs, FixedPoint *positions, QPainterPath *path);
    00199
    00200     /*
    00201     enum Extension {
    00202         GetTrueTypeTable
    00203     };
    00204
    00205     virtual bool supportsExtension(Extension extension) const;
    00206     virtual QVariant extension(Extension extension, const QVariant &argument = QVariant());
    00207     */
    00208
    00209 private:
    00210     Q_DECLARE_PRIVATE(QAbstractFontEngine)
    00211     Q_DISABLE_COPY(QAbstractFontEngine)
    00212 };
    00213
    00214 Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractFontEngine::Capabilities)
    00215 Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractFontEngine::TextShapingFlags)
    00216
    00217 QT_END_NAMESPACE
    00218
    00219 QT_END_HEADER
    00220
    00221 #endif