73 Q_ASSERT(m_trueTypeExtension->HasTrueTypeTable(tag)); |
73 Q_ASSERT(m_trueTypeExtension->HasTrueTypeTable(tag)); |
74 TInt error = KErrNone; |
74 TInt error = KErrNone; |
75 TInt tableByteLength = 0; |
75 TInt tableByteLength = 0; |
76 TAny *table = q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength)); |
76 TAny *table = q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength)); |
77 QByteArray result(static_cast<const char*>(table), tableByteLength); |
77 QByteArray result(static_cast<const char*>(table), tableByteLength); |
|
78 m_trueTypeExtension->ReleaseTrueTypeTable(table); |
|
79 return result; |
|
80 } |
|
81 |
|
82 bool QFontEngineS60Extensions::getSfntTableData(uint tag, uchar *buffer, uint *length) const |
|
83 { |
|
84 if (!m_trueTypeExtension->HasTrueTypeTable(tag)) |
|
85 return false; |
|
86 |
|
87 bool result = true; |
|
88 TInt error = KErrNone; |
|
89 TInt tableByteLength; |
|
90 TAny *table = |
|
91 q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength)); |
|
92 |
|
93 if (error != KErrNone) { |
|
94 return false; |
|
95 } else if (*length > 0 && *length < tableByteLength) { |
|
96 result = false; // Caller did not allocate enough memory |
|
97 } else { |
|
98 *length = tableByteLength; |
|
99 if (buffer) |
|
100 qMemCopy(buffer, table, tableByteLength); |
|
101 } |
|
102 |
78 m_trueTypeExtension->ReleaseTrueTypeTable(table); |
103 m_trueTypeExtension->ReleaseTrueTypeTable(table); |
79 return result; |
104 return result; |
80 } |
105 } |
81 |
106 |
82 const unsigned char *QFontEngineS60Extensions::cmap() const |
107 const unsigned char *QFontEngineS60Extensions::cmap() const |
194 return false; |
219 return false; |
195 } |
220 } |
196 |
221 |
197 HB_Glyph *g = glyphs->glyphs; |
222 HB_Glyph *g = glyphs->glyphs; |
198 const unsigned char* cmap = m_extensions->cmap(); |
223 const unsigned char* cmap = m_extensions->cmap(); |
|
224 const bool isRtl = (flags & QTextEngine::RightToLeft); |
199 for (int i = 0; i < len; ++i) { |
225 for (int i = 0; i < len; ++i) { |
200 const unsigned int uc = getChar(characters, i, len); |
226 const unsigned int uc = getChar(characters, i, len); |
201 *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap, uc); |
227 *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap, |
|
228 isRtl ? QChar::mirroredChar(uc) : uc); |
202 } |
229 } |
203 |
230 |
204 glyphs->numGlyphs = g - glyphs->glyphs; |
231 glyphs->numGlyphs = g - glyphs->glyphs; |
205 *nglyphs = glyphs->numGlyphs; |
232 *nglyphs = glyphs->numGlyphs; |
206 |
233 |
214 void QFontEngineS60::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const |
241 void QFontEngineS60::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags flags) const |
215 { |
242 { |
216 Q_UNUSED(flags); |
243 Q_UNUSED(flags); |
217 for (int i = 0; i < glyphs->numGlyphs; i++) { |
244 for (int i = 0; i < glyphs->numGlyphs; i++) { |
218 const glyph_metrics_t bbox = boundingBox_const(glyphs->glyphs[i]); |
245 const glyph_metrics_t bbox = boundingBox_const(glyphs->glyphs[i]); |
219 glyphs->advances_x[i] = glyphs->offsets[i].x = bbox.xoff; |
246 glyphs->advances_x[i] = bbox.xoff; |
220 glyphs->advances_y[i] = glyphs->offsets[i].y = bbox.yoff; |
247 glyphs->advances_y[i] = bbox.yoff; |
221 } |
248 } |
222 } |
249 } |
223 |
250 |
224 QImage QFontEngineS60::alphaMapForGlyph(glyph_t glyph) |
251 QImage QFontEngineS60::alphaMapForGlyph(glyph_t glyph) |
225 { |
252 { |
324 QByteArray QFontEngineS60::getSfntTable(uint tag) const |
351 QByteArray QFontEngineS60::getSfntTable(uint tag) const |
325 { |
352 { |
326 return m_extensions->getSfntTable(tag); |
353 return m_extensions->getSfntTable(tag); |
327 } |
354 } |
328 |
355 |
|
356 bool QFontEngineS60::getSfntTableData(uint tag, uchar *buffer, uint *length) const |
|
357 { |
|
358 return m_extensions->getSfntTableData(tag, buffer, length); |
|
359 } |
|
360 |
329 QFontEngine::Type QFontEngineS60::type() const |
361 QFontEngine::Type QFontEngineS60::type() const |
330 { |
362 { |
331 return QFontEngine::S60FontEngine; |
363 return QFontEngine::S60FontEngine; |
332 } |
364 } |
333 |
365 |