1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtGui module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QFONTENGINE_X11_P_H
43 #define QFONTENGINE_X11_P_H
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.
55 #include <private/qt_x11_p.h>
57 #include <private/qfontengine_ft_p.h>
63 // --------------------------------------------------------------------------
65 class QFontEngineMultiXLFD : public QFontEngineMulti
68 QFontEngineMultiXLFD(const QFontDef &r, const QList<int> &l, int s);
69 ~QFontEngineMultiXLFD();
71 void loadEngine(int at);
80 * \internal The font engine for X Logical Font Description (XLFD) fonts, which is for X11 systems without freetype.
82 class QFontEngineXLFD : public QFontEngine
85 QFontEngineXLFD(XFontStruct *f, const QByteArray &name, int mib);
88 virtual QFontEngine::FaceId faceId() const;
89 QFontEngine::Properties properties() const;
90 virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics);
91 virtual bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
92 virtual int synthesized() const;
94 virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs,
95 QTextEngine::ShaperFlags flags) const;
96 virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const;
98 virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
99 virtual glyph_metrics_t boundingBox(glyph_t glyph);
101 virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags);
102 virtual QFixed ascent() const;
103 virtual QFixed descent() const;
104 virtual QFixed leading() const;
105 virtual qreal maxCharWidth() const;
106 virtual qreal minLeftBearing() const;
107 virtual qreal minRightBearing() const;
108 virtual QImage alphaMapForGlyph(glyph_t);
110 virtual inline Type type() const
111 { return QFontEngine::XLFD; }
113 virtual bool canRender(const QChar *string, int len);
114 virtual const char *name() const;
116 inline XFontStruct *fontStruct() const
119 #ifndef QT_NO_FREETYPE
120 FT_Face non_locked_face() const;
121 glyph_t glyphIndexToFreetypeGlyphIndex(glyph_t g) const;
123 uint toUnicode(glyph_t g) const;
126 QBitmap bitmapForGlyphs(const QGlyphLayout &glyphs, const glyph_metrics_t &metrics, QTextItem::RenderFlags flags = 0);
132 int lbearing, rbearing;
133 mutable QFontEngine::FaceId face_id;
134 mutable QFreetypeFace *freetype;
138 #ifndef QT_NO_FONTCONFIG
140 class Q_GUI_EXPORT QFontEngineMultiFT : public QFontEngineMulti
143 QFontEngineMultiFT(QFontEngine *fe, FcPattern *firstEnginePattern, FcPattern *p, int s, const QFontDef &request);
144 ~QFontEngineMultiFT();
146 void loadEngine(int at);
151 FcPattern *firstEnginePattern;
154 int firstFontIndex; // first font in fontset
157 class Q_GUI_EXPORT QFontEngineX11FT : public QFontEngineFT
160 explicit QFontEngineX11FT(const QFontDef &fontDef) : QFontEngineFT(fontDef) {}
161 explicit QFontEngineX11FT(FcPattern *pattern, const QFontDef &fd, int screen);
164 QFontEngine *cloneWithSize(qreal pixelSize) const;
166 #ifndef QT_NO_XRENDER
171 virtual bool uploadGlyphToServer(QGlyphSet *set, uint glyphid, Glyph *g, GlyphInfo *info, int glyphDataSize) const;
172 virtual unsigned long allocateServerGlyphSet();
173 virtual void freeServerGlyphSet(unsigned long id);
176 #endif // QT_NO_FONTCONFIG
180 #endif // QFONTENGINE_X11_P_H