52 // |
52 // |
53 // We mean it. |
53 // We mean it. |
54 // |
54 // |
55 |
55 |
56 #include "qconfig.h" |
56 #include "qconfig.h" |
57 #include "qfontengine_p.h" |
57 #include <private/qfontengine_p.h> |
58 #include "qsize.h" |
58 #include "qsize.h" |
59 #include <openfont.h> |
59 #include <openfont.h> |
|
60 |
|
61 // This is a very hackish way to detect Symbian^4 and needs to be removed |
|
62 // once device profiles for proper feature detection are available |
|
63 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
64 #define Q_SYMBIAN_HAS_FONTTABLE_API |
|
65 #endif |
|
66 |
|
67 #ifdef Q_SYMBIAN_HAS_FONTTABLE_API |
|
68 #define Q_SYMBIAN_HAS_GLYPHOUTLINE_API |
|
69 #endif // Q_SYMBIAN_HAS_FONTTABLE_API |
60 |
70 |
61 class CFont; |
71 class CFont; |
62 |
72 |
63 QT_BEGIN_NAMESPACE |
73 QT_BEGIN_NAMESPACE |
64 |
74 |
65 // ..gives us access to truetype tables |
75 // ..gives us access to truetype tables |
66 class QSymbianTypeFaceExtras |
76 class QSymbianTypeFaceExtras |
67 { |
77 { |
68 public: |
78 public: |
69 QSymbianTypeFaceExtras(CFont* fontOwner, COpenFont *font); |
79 QSymbianTypeFaceExtras(CFont* cFont, COpenFont *openFont = 0); |
|
80 ~QSymbianTypeFaceExtras(); |
70 |
81 |
71 QByteArray getSfntTable(uint tag) const; |
82 QByteArray getSfntTable(uint tag) const; |
72 bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; |
83 bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; |
73 const unsigned char *cmap() const; |
84 const uchar *cmap() const; |
74 CFont *fontOwner() const; |
85 CFont *fontOwner() const; |
75 |
86 |
76 private: |
87 private: |
77 COpenFont *m_font; |
88 CFont* m_cFont; |
78 mutable MOpenFontTrueTypeExtension *m_trueTypeExtension; |
|
79 mutable const unsigned char *m_cmap; |
|
80 mutable bool m_symbolCMap; |
89 mutable bool m_symbolCMap; |
81 mutable QByteArray m_cmapTable; |
90 mutable QByteArray m_cmapTable; |
82 CFont* m_fontOwner; |
91 #ifndef Q_SYMBIAN_HAS_FONTTABLE_API |
|
92 COpenFont *m_openFont; |
|
93 mutable MOpenFontTrueTypeExtension *m_trueTypeExtension; |
|
94 #endif // Q_SYMBIAN_HAS_FONTTABLE_API |
83 }; |
95 }; |
84 |
96 |
85 class QFontEngineS60 : public QFontEngine |
97 class QFontEngineS60 : public QFontEngine |
86 { |
98 { |
87 public: |
99 public: |
88 QFontEngineS60(const QFontDef &fontDef, const QSymbianTypeFaceExtras *extras); |
100 QFontEngineS60(const QFontDef &fontDef, const QSymbianTypeFaceExtras *extras); |
89 ~QFontEngineS60(); |
101 ~QFontEngineS60(); |
90 |
102 |
91 bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; |
103 bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; |
92 void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const; |
104 void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const; |
|
105 |
|
106 void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, |
|
107 QPainterPath *path, QTextItem::RenderFlags flags); |
93 |
108 |
94 QImage alphaMapForGlyph(glyph_t glyph); |
109 QImage alphaMapForGlyph(glyph_t glyph); |
95 |
110 |
96 glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); |
111 glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); |
97 glyph_metrics_t boundingBox_const(glyph_t glyph) const; // Const correctnes quirk. |
112 glyph_metrics_t boundingBox_const(glyph_t glyph) const; // Const correctnes quirk. |
119 void getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metrics, const TUint8*& bitmap, TSize& bitmapSize) const; |
134 void getCharacterData(glyph_t glyph, TOpenFontCharMetrics& metrics, const TUint8*& bitmap, TSize& bitmapSize) const; |
120 void setFontScale(qreal scale); |
135 void setFontScale(qreal scale); |
121 |
136 |
122 private: |
137 private: |
123 friend class QFontPrivate; |
138 friend class QFontPrivate; |
|
139 friend class QSymbianVGFontGlyphCache; |
124 |
140 |
125 QFixed glyphAdvance(HB_Glyph glyph) const; |
141 QFixed glyphAdvance(HB_Glyph glyph) const; |
126 CFont *fontWithSize(qreal size) const; |
142 CFont *fontWithSize(qreal size) const; |
127 static void releaseFont(CFont *&font); |
143 static void releaseFont(CFont *&font); |
128 |
144 |