1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtGui module of the Qt Toolkit.
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.
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.
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.
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.
40 ****************************************************************************/
45 #include <QtCore/qstring.h>
46 #include <QtCore/qiodevice.h>
47 #include <QtCore/qglobal.h>
48 #include <QtCore/qobject.h>
49 #include <QtCore/qpoint.h>
50 #include <QtGui/qfont.h>
51 #include <QtGui/qtransform.h>
52 #include <QtGui/qfontdatabase.h>
54 #if !defined(QT_NO_RAWFONT)
61 class QRawFontPrivate;
62 class Q_GUI_EXPORT QRawFont
65 enum AntialiasingType {
71 QRawFont(const QString &fileName,
73 QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting);
74 QRawFont(const QByteArray &fontData,
76 QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting);
77 QRawFont(const QRawFont &other);
82 QRawFont &operator=(const QRawFont &other);
84 bool operator==(const QRawFont &other) const;
85 inline bool operator!=(const QRawFont &other) const
86 { return !operator==(other); }
88 QString familyName() const;
89 QString styleName() const;
91 QFont::Style style() const;
94 QVector<quint32> glyphIndexesForString(const QString &text) const;
95 QVector<QPointF> advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes) const;
96 bool glyphIndexesForChars(const QChar *chars, int numChars, quint32 *glyphIndexes, int *numGlyphs) const;
97 bool advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs) const;
99 QImage alphaMapForGlyph(quint32 glyphIndex,
100 AntialiasingType antialiasingType = SubPixelAntialiasing,
101 const QTransform &transform = QTransform()) const;
102 QPainterPath pathForGlyph(quint32 glyphIndex) const;
103 QRectF boundingRect(quint32 glyphIndex) const;
105 void setPixelSize(qreal pixelSize);
106 qreal pixelSize() const;
108 QFont::HintingPreference hintingPreference() const;
110 qreal ascent() const;
111 qreal descent() const;
112 qreal leading() const;
113 qreal xHeight() const;
114 qreal averageCharWidth() const;
115 qreal maxCharWidth() const;
116 qreal lineThickness() const;
117 qreal underlinePosition() const;
119 qreal unitsPerEm() const;
121 void loadFromFile(const QString &fileName,
123 QFont::HintingPreference hintingPreference);
125 void loadFromData(const QByteArray &fontData,
127 QFont::HintingPreference hintingPreference);
129 bool supportsCharacter(quint32 ucs4) const;
130 bool supportsCharacter(const QChar &character) const;
131 QList<QFontDatabase::WritingSystem> supportedWritingSystems() const;
133 QByteArray fontTable(const char *tagName) const;
135 static QRawFont fromFont(const QFont &font,
136 QFontDatabase::WritingSystem writingSystem = QFontDatabase::Any);
139 friend class QRawFontPrivate;
140 friend class QTextLayout;
142 QExplicitlySharedDataPointer<QRawFontPrivate> d;
149 #endif // QT_NO_RAWFONT