source: trunk/src/gui/text/qfontengine_x11_p.h@ 5

Last change on this file since 5 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 5.7 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QFONTENGINE_X11_P_H
43#define QFONTENGINE_X11_P_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#include <private/qt_x11_p.h>
56
57#include <private/qfontengine_ft_p.h>
58
59QT_BEGIN_NAMESPACE
60
61class QFreetypeFace;
62
63// --------------------------------------------------------------------------
64
65class QFontEngineMultiXLFD : public QFontEngineMulti
66{
67public:
68 QFontEngineMultiXLFD(const QFontDef &r, const QList<int> &l, int s);
69 ~QFontEngineMultiXLFD();
70
71 void loadEngine(int at);
72
73private:
74 QList<int> encodings;
75 int screen;
76 QFontDef request;
77};
78
79/**
80 * \internal The font engine for X Logical Font Description (XLFD) fonts, which is for X11 systems without freetype.
81 */
82class QFontEngineXLFD : public QFontEngine
83{
84public:
85 QFontEngineXLFD(XFontStruct *f, const QByteArray &name, int mib);
86 ~QFontEngineXLFD();
87
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;
93
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;
97
98 virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs);
99 virtual glyph_metrics_t boundingBox(glyph_t glyph);
100
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);
109
110 virtual inline Type type() const
111 { return QFontEngine::XLFD; }
112
113 virtual bool canRender(const QChar *string, int len);
114 virtual const char *name() const;
115
116 inline XFontStruct *fontStruct() const
117 { return _fs; }
118
119#ifndef QT_NO_FREETYPE
120 FT_Face non_locked_face() const;
121 glyph_t glyphIndexToFreetypeGlyphIndex(glyph_t g) const;
122#endif
123 uint toUnicode(glyph_t g) const;
124
125private:
126 QBitmap bitmapForGlyphs(const QGlyphLayout &glyphs, const glyph_metrics_t &metrics, QTextItem::RenderFlags flags = 0);
127
128 XFontStruct *_fs;
129 QByteArray _name;
130 QTextCodec *_codec;
131 int _cmap;
132 int lbearing, rbearing;
133 mutable QFontEngine::FaceId face_id;
134 mutable QFreetypeFace *freetype;
135 mutable int synth;
136};
137
138#ifndef QT_NO_FONTCONFIG
139
140class Q_GUI_EXPORT QFontEngineMultiFT : public QFontEngineMulti
141{
142public:
143 QFontEngineMultiFT(QFontEngine *fe, FcPattern *firstEnginePattern, FcPattern *p, int s, const QFontDef &request);
144 ~QFontEngineMultiFT();
145
146 void loadEngine(int at);
147
148private:
149 QFontDef request;
150 FcPattern *pattern;
151 FcPattern *firstEnginePattern;
152 FcFontSet *fontSet;
153 int screen;
154 int firstFontIndex; // first font in fontset
155};
156
157class Q_GUI_EXPORT QFontEngineX11FT : public QFontEngineFT
158{
159public:
160 explicit QFontEngineX11FT(FcPattern *pattern, const QFontDef &fd, int screen);
161 ~QFontEngineX11FT();
162
163#ifndef QT_NO_XRENDER
164 int xglyph_format;
165#endif
166
167protected:
168 virtual bool uploadGlyphToServer(QGlyphSet *set, uint glyphid, Glyph *g, GlyphInfo *info, int glyphDataSize) const;
169 virtual unsigned long allocateServerGlyphSet();
170 virtual void freeServerGlyphSet(unsigned long id);
171};
172
173#endif // QT_NO_FONTCONFIG
174
175QT_END_NAMESPACE
176
177#endif // QFONTENGINE_X11_P_H
Note: See TracBrowser for help on using the repository browser.