author | William Roberts <williamr@symbian.org> |
Thu, 22 Jul 2010 16:41:55 +0100 | |
branch | GCC_SURGE |
changeset 31 | 5daf16870df6 |
parent 30 | 5dc02b23752f |
child 33 | 3e2da88830cd |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
0 | 8 |
** |
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QFONTENGINE_S60_P_H |
|
43 |
#define QFONTENGINE_S60_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 |
||
56 |
#include "qconfig.h" |
|
57 |
#include "qfontengine_p.h" |
|
58 |
#include "qsize.h" |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
#include <openfont.h> |
0 | 60 |
|
61 |
class CFont; |
|
62 |
||
63 |
QT_BEGIN_NAMESPACE |
|
64 |
||
25
e24348a560a6
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
65 |
// ..gives us access to truetype tables |
e24348a560a6
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
66 |
class QSymbianTypeFaceExtras |
0 | 67 |
{ |
68 |
public: |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
69 |
QSymbianTypeFaceExtras(CFont* fontOwner, COpenFont *font); |
0 | 70 |
|
71 |
QByteArray getSfntTable(uint tag) const; |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
72 |
bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
73 |
const unsigned char *cmap() const; |
0 | 74 |
CFont *fontOwner() const; |
75 |
||
76 |
private: |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
77 |
COpenFont *m_font; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
78 |
mutable MOpenFontTrueTypeExtension *m_trueTypeExtension; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
79 |
mutable const unsigned char *m_cmap; |
0 | 80 |
mutable bool m_symbolCMap; |
81 |
mutable QByteArray m_cmapTable; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
82 |
CFont* m_fontOwner; |
0 | 83 |
}; |
84 |
||
85 |
class QFontEngineS60 : public QFontEngine |
|
86 |
{ |
|
87 |
public: |
|
25
e24348a560a6
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
88 |
QFontEngineS60(const QFontDef &fontDef, const QSymbianTypeFaceExtras *extras); |
0 | 89 |
~QFontEngineS60(); |
90 |
||
91 |
bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; |
|
92 |
void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const; |
|
93 |
||
94 |
QImage alphaMapForGlyph(glyph_t glyph); |
|
95 |
||
96 |
glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); |
|
97 |
glyph_metrics_t boundingBox_const(glyph_t glyph) const; // Const correctnes quirk. |
|
98 |
glyph_metrics_t boundingBox(glyph_t glyph); |
|
99 |
||
100 |
QFixed ascent() const; |
|
101 |
QFixed descent() const; |
|
102 |
QFixed leading() const; |
|
103 |
qreal maxCharWidth() const; |
|
104 |
qreal minLeftBearing() const { return 0; } |
|
105 |
qreal minRightBearing() const { return 0; } |
|
106 |
||
107 |
QByteArray getSfntTable(uint tag) const; |
|
22
79de32ba3296
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
108 |
bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; |
0 | 109 |
|
110 |
static qreal pixelsToPoints(qreal pixels, Qt::Orientation orientation = Qt::Horizontal); |
|
111 |
static qreal pointsToPixels(qreal points, Qt::Orientation orientation = Qt::Horizontal); |
|
112 |
||
113 |
const char *name() const; |
|
114 |
||
115 |
bool canRender(const QChar *string, int len); |
|
116 |
||
117 |
Type type() const; |
|
118 |
||
119 |
void getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metrics, const TUint8*& bitmap, TSize& bitmapSize) const; |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
120 |
void setFontScale(qreal scale); |
0 | 121 |
|
122 |
private: |
|
123 |
friend class QFontPrivate; |
|
124 |
||
125 |
QFixed glyphAdvance(HB_Glyph glyph) const; |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
126 |
CFont *fontWithSize(qreal size) const; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
127 |
static void releaseFont(CFont *&font); |
0 | 128 |
|
25
e24348a560a6
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
129 |
const QSymbianTypeFaceExtras *m_extras; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
130 |
CFont* m_originalFont; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
131 |
const qreal m_originalFontSizeInPixels; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
132 |
CFont* m_scaledFont; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
133 |
qreal m_scaledFontSizeInPixels; |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
134 |
CFont* m_activeFont; |
0 | 135 |
}; |
136 |
||
137 |
class QFontEngineMultiS60 : public QFontEngineMulti |
|
138 |
{ |
|
139 |
public: |
|
140 |
QFontEngineMultiS60(QFontEngine *first, int script, const QStringList &fallbackFamilies); |
|
141 |
void loadEngine(int at); |
|
142 |
||
143 |
int m_script; |
|
144 |
QStringList m_fallbackFamilies; |
|
145 |
}; |
|
146 |
||
147 |
QT_END_NAMESPACE |
|
148 |
||
149 |
#endif // QFONTENGINE_S60_P_H |