src/gui/text/qfontengine_s60.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
   162         const uchar *cmap = QFontEngine::getCMap(reinterpret_cast<const uchar *>
   162         const uchar *cmap = QFontEngine::getCMap(reinterpret_cast<const uchar *>
   163                 (cmapTable.constData()), cmapTable.size(), &m_symbolCMap, &size);
   163                 (cmapTable.constData()), cmapTable.size(), &m_symbolCMap, &size);
   164         m_cmapTable = QByteArray(reinterpret_cast<const char *>(cmap), size);
   164         m_cmapTable = QByteArray(reinterpret_cast<const char *>(cmap), size);
   165     }
   165     }
   166     return reinterpret_cast<const uchar *>(m_cmapTable.constData());
   166     return reinterpret_cast<const uchar *>(m_cmapTable.constData());
       
   167 }
       
   168 
       
   169 bool QSymbianTypeFaceExtras::isSymbolCMap() const
       
   170 {
       
   171     return m_symbolCMap;
   167 }
   172 }
   168 
   173 
   169 CFont *QSymbianTypeFaceExtras::fontOwner() const
   174 CFont *QSymbianTypeFaceExtras::fontOwner() const
   170 {
   175 {
   171     return m_cFont;
   176     return m_cFont;
   254     const unsigned char* cmap = m_extras->cmap();
   259     const unsigned char* cmap = m_extras->cmap();
   255     const bool isRtl = (flags & QTextEngine::RightToLeft);
   260     const bool isRtl = (flags & QTextEngine::RightToLeft);
   256     for (int i = 0; i < len; ++i) {
   261     for (int i = 0; i < len; ++i) {
   257         const unsigned int uc = getChar(characters, i, len);
   262         const unsigned int uc = getChar(characters, i, len);
   258         *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap,
   263         *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap,
   259         		isRtl ? QChar::mirroredChar(uc) : uc);
   264                         (isRtl && !m_extras->isSymbolCMap()) ? QChar::mirroredChar(uc) : uc);
   260     }
   265     }
   261 
   266 
   262     glyphs->numGlyphs = g - glyphs->glyphs;
   267     glyphs->numGlyphs = g - glyphs->glyphs;
   263     *nglyphs = glyphs->numGlyphs;
   268     *nglyphs = glyphs->numGlyphs;
   264 
   269 
   343 
   348 
   344     QFixed w = 0;
   349     QFixed w = 0;
   345     for (int i = 0; i < glyphs.numGlyphs; ++i)
   350     for (int i = 0; i < glyphs.numGlyphs; ++i)
   346         w += glyphs.effectiveAdvance(i);
   351         w += glyphs.effectiveAdvance(i);
   347 
   352 
   348     return glyph_metrics_t(0, -ascent(), w, ascent()+descent()+1, w, 0);
   353     return glyph_metrics_t(0, -ascent(), w - lastRightBearing(glyphs), ascent()+descent()+1, w, 0);
   349 }
   354 }
   350 
   355 
   351 glyph_metrics_t QFontEngineS60::boundingBox_const(glyph_t glyph) const
   356 glyph_metrics_t QFontEngineS60::boundingBox_const(glyph_t glyph) const
   352 {
   357 {
   353     TOpenFontCharMetrics metrics;
   358     TOpenFontCharMetrics metrics;
   372     return boundingBox_const(glyph);
   377     return boundingBox_const(glyph);
   373 }
   378 }
   374 
   379 
   375 QFixed QFontEngineS60::ascent() const
   380 QFixed QFontEngineS60::ascent() const
   376 {
   381 {
   377     return m_originalFont->FontMaxAscent();
   382     // Workaround for QTBUG-8013
       
   383     // Stroke based fonts may return an incorrect FontMaxAscent of 0.
       
   384     const QFixed ascent = m_originalFont->FontMaxAscent();
       
   385     return (ascent > 0) ? ascent : QFixed::fromReal(m_originalFontSizeInPixels) - descent();
   378 }
   386 }
   379 
   387 
   380 QFixed QFontEngineS60::descent() const
   388 QFixed QFontEngineS60::descent() const
   381 {
   389 {
   382     return m_originalFont->FontMaxDescent();
   390     return m_originalFont->FontMaxDescent();