Changeset 769 for trunk/src/gui/text/qfontengine_s60.cpp
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/text/qfontengine_s60.cpp
r651 r769 45 45 #include <private/qapplication_p.h> 46 46 #include "qimage.h" 47 #include "qt_s60_p.h"47 #include <private/qt_s60_p.h> 48 48 49 49 #include <e32base.h> … … 54 54 QT_BEGIN_NAMESPACE 55 55 56 Q FontEngineS60Extensions::QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font)56 QSymbianTypeFaceExtras::QSymbianTypeFaceExtras(CFont* fontOwner, COpenFont *font) 57 57 : m_font(font) 58 58 , m_cmap(0) … … 60 60 , m_fontOwner(fontOwner) 61 61 { 62 TAny *shapingExtension = NULL;63 m_font->ExtendedInterface(KUidOpenFontShapingExtension, shapingExtension);64 m_shapingExtension = static_cast<MOpenFontShapingExtension*>(shapingExtension);65 62 TAny *trueTypeExtension = NULL; 66 63 m_font->ExtendedInterface(KUidOpenFontTrueTypeExtension, trueTypeExtension); 67 64 m_trueTypeExtension = static_cast<MOpenFontTrueTypeExtension*>(trueTypeExtension); 68 Q_ASSERT(m_ shapingExtension && m_trueTypeExtension);69 } 70 71 QByteArray Q FontEngineS60Extensions::getSfntTable(uint tag) const65 Q_ASSERT(m_trueTypeExtension); 66 } 67 68 QByteArray QSymbianTypeFaceExtras::getSfntTable(uint tag) const 72 69 { 73 70 Q_ASSERT(m_trueTypeExtension->HasTrueTypeTable(tag)); … … 80 77 } 81 78 82 const unsigned char *QFontEngineS60Extensions::cmap() const 79 bool QSymbianTypeFaceExtras::getSfntTableData(uint tag, uchar *buffer, uint *length) const 80 { 81 if (!m_trueTypeExtension->HasTrueTypeTable(tag)) 82 return false; 83 84 bool result = true; 85 TInt error = KErrNone; 86 TInt tableByteLength; 87 TAny *table = 88 q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength)); 89 90 if (error != KErrNone) { 91 return false; 92 } else if (*length > 0 && *length < tableByteLength) { 93 result = false; // Caller did not allocate enough memory 94 } else { 95 *length = tableByteLength; 96 if (buffer) 97 qMemCopy(buffer, table, tableByteLength); 98 } 99 100 m_trueTypeExtension->ReleaseTrueTypeTable(table); 101 return result; 102 } 103 104 const unsigned char *QSymbianTypeFaceExtras::cmap() const 83 105 { 84 106 if (!m_cmap) { … … 90 112 } 91 113 92 QPainterPath QFontEngineS60Extensions::glyphOutline(glyph_t glyph) const 93 { 94 QPainterPath result; 95 QPolygonF polygon; 96 TInt glyphIndex = glyph; 97 TInt pointNumber = 0; 98 TInt x, y; 99 while (m_shapingExtension->GlyphPointInFontUnits(glyphIndex, pointNumber++, x, y)) { 100 const QPointF point(qreal(x) / 0xffff, qreal(y) / 0xffff); 101 if (polygon.contains(point)) { 102 result.addPolygon(polygon); 103 result.closeSubpath(); 104 polygon.clear(); 105 } else { 106 polygon.append(point); 107 } 108 } 109 return result; 110 } 111 112 CFont *QFontEngineS60Extensions::fontOwner() const 114 CFont *QSymbianTypeFaceExtras::fontOwner() const 113 115 { 114 116 return m_fontOwner; … … 168 170 } 169 171 170 QFontEngineS60::QFontEngineS60(const QFontDef &request, const Q FontEngineS60Extensions *extensions)171 : m_ext ensions(extensions)172 QFontEngineS60::QFontEngineS60(const QFontDef &request, const QSymbianTypeFaceExtras *extras) 173 : m_extras(extras) 172 174 , m_originalFont(0) 173 175 , m_originalFontSizeInPixels((request.pixelSize >= 0)? … … 196 198 197 199 HB_Glyph *g = glyphs->glyphs; 198 const unsigned char* cmap = m_extensions->cmap(); 200 const unsigned char* cmap = m_extras->cmap(); 201 const bool isRtl = (flags & QTextEngine::RightToLeft); 199 202 for (int i = 0; i < len; ++i) { 200 203 const unsigned int uc = getChar(characters, i, len); 201 *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap, uc); 204 *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap, 205 isRtl ? QChar::mirroredChar(uc) : uc); 202 206 } 203 207 … … 217 221 for (int i = 0; i < glyphs->numGlyphs; i++) { 218 222 const glyph_metrics_t bbox = boundingBox_const(glyphs->glyphs[i]); 219 glyphs->advances_x[i] = glyphs->offsets[i].x =bbox.xoff;220 glyphs->advances_y[i] = glyphs->offsets[i].y =bbox.yoff;223 glyphs->advances_x[i] = bbox.xoff; 224 glyphs->advances_y[i] = bbox.yoff; 221 225 } 222 226 } … … 313 317 bool QFontEngineS60::canRender(const QChar *string, int len) 314 318 { 315 const unsigned char *cmap = m_ext ensions->cmap();319 const unsigned char *cmap = m_extras->cmap(); 316 320 for (int i = 0; i < len; ++i) { 317 321 const unsigned int uc = getChar(string, i, len); … … 324 328 QByteArray QFontEngineS60::getSfntTable(uint tag) const 325 329 { 326 return m_extensions->getSfntTable(tag); 330 return m_extras->getSfntTable(tag); 331 } 332 333 bool QFontEngineS60::getSfntTableData(uint tag, uchar *buffer, uint *length) const 334 { 335 return m_extras->getSfntTableData(tag, buffer, length); 327 336 } 328 337
Note:
See TracChangeset
for help on using the changeset viewer.