summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_s60.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qfontengine_s60.cpp')
-rw-r--r--src/gui/text/qfontengine_s60.cpp55
1 files changed, 17 insertions, 38 deletions
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index c9ff661..93f02ff 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -53,22 +53,19 @@
QT_BEGIN_NAMESPACE
-QFontEngineS60Extensions::QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font)
+QSymbianTypeFaceExtras::QSymbianTypeFaceExtras(CFont* fontOwner, COpenFont *font)
: m_font(font)
, m_cmap(0)
, m_symbolCMap(false)
, m_fontOwner(fontOwner)
{
- TAny *shapingExtension = NULL;
- m_font->ExtendedInterface(KUidOpenFontShapingExtension, shapingExtension);
- m_shapingExtension = static_cast<MOpenFontShapingExtension*>(shapingExtension);
TAny *trueTypeExtension = NULL;
m_font->ExtendedInterface(KUidOpenFontTrueTypeExtension, trueTypeExtension);
m_trueTypeExtension = static_cast<MOpenFontTrueTypeExtension*>(trueTypeExtension);
- Q_ASSERT(m_shapingExtension && m_trueTypeExtension);
+ Q_ASSERT(m_trueTypeExtension);
}
-QByteArray QFontEngineS60Extensions::getSfntTable(uint tag) const
+QByteArray QSymbianTypeFaceExtras::getSfntTable(uint tag) const
{
Q_ASSERT(m_trueTypeExtension->HasTrueTypeTable(tag));
TInt error = KErrNone;
@@ -79,7 +76,7 @@ QByteArray QFontEngineS60Extensions::getSfntTable(uint tag) const
return result;
}
-bool QFontEngineS60Extensions::getSfntTableData(uint tag, uchar *buffer, uint *length) const
+bool QSymbianTypeFaceExtras::getSfntTableData(uint tag, uchar *buffer, uint *length) const
{
if (!m_trueTypeExtension->HasTrueTypeTable(tag))
return false;
@@ -104,7 +101,7 @@ bool QFontEngineS60Extensions::getSfntTableData(uint tag, uchar *buffer, uint *l
return result;
}
-const unsigned char *QFontEngineS60Extensions::cmap() const
+const unsigned char *QSymbianTypeFaceExtras::cmap() const
{
if (!m_cmap) {
m_cmapTable = getSfntTable(MAKE_TAG('c', 'm', 'a', 'p'));
@@ -114,27 +111,7 @@ const unsigned char *QFontEngineS60Extensions::cmap() const
return m_cmap;
}
-QPainterPath QFontEngineS60Extensions::glyphOutline(glyph_t glyph) const
-{
- QPainterPath result;
- QPolygonF polygon;
- TInt glyphIndex = glyph;
- TInt pointNumber = 0;
- TInt x, y;
- while (m_shapingExtension->GlyphPointInFontUnits(glyphIndex, pointNumber++, x, y)) {
- const QPointF point(qreal(x) / 0xffff, qreal(y) / 0xffff);
- if (polygon.contains(point)) {
- result.addPolygon(polygon);
- result.closeSubpath();
- polygon.clear();
- } else {
- polygon.append(point);
- }
- }
- return result;
-}
-
-CFont *QFontEngineS60Extensions::fontOwner() const
+CFont *QSymbianTypeFaceExtras::fontOwner() const
{
return m_fontOwner;
}
@@ -192,8 +169,8 @@ void QFontEngineS60::releaseFont(CFont *&font)
}
}
-QFontEngineS60::QFontEngineS60(const QFontDef &request, const QFontEngineS60Extensions *extensions)
- : m_extensions(extensions)
+QFontEngineS60::QFontEngineS60(const QFontDef &request, const QSymbianTypeFaceExtras *extras)
+ : m_extras(extras)
, m_originalFont(0)
, m_originalFontSizeInPixels((request.pixelSize >= 0)?
request.pixelSize:pointsToPixels(request.pointSize))
@@ -220,10 +197,12 @@ bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout
}
HB_Glyph *g = glyphs->glyphs;
- const unsigned char* cmap = m_extensions->cmap();
+ const unsigned char* cmap = m_extras->cmap();
+ const bool isRtl = (flags & QTextEngine::RightToLeft);
for (int i = 0; i < len; ++i) {
const unsigned int uc = getChar(characters, i, len);
- *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap, uc);
+ *g++ = QFontEngine::getTrueTypeGlyphIndex(cmap,
+ isRtl ? QChar::mirroredChar(uc) : uc);
}
glyphs->numGlyphs = g - glyphs->glyphs;
@@ -241,8 +220,8 @@ void QFontEngineS60::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla
Q_UNUSED(flags);
for (int i = 0; i < glyphs->numGlyphs; i++) {
const glyph_metrics_t bbox = boundingBox_const(glyphs->glyphs[i]);
- glyphs->advances_x[i] = glyphs->offsets[i].x = bbox.xoff;
- glyphs->advances_y[i] = glyphs->offsets[i].y = bbox.yoff;
+ glyphs->advances_x[i] = bbox.xoff;
+ glyphs->advances_y[i] = bbox.yoff;
}
}
@@ -337,7 +316,7 @@ const char *QFontEngineS60::name() const
bool QFontEngineS60::canRender(const QChar *string, int len)
{
- const unsigned char *cmap = m_extensions->cmap();
+ const unsigned char *cmap = m_extras->cmap();
for (int i = 0; i < len; ++i) {
const unsigned int uc = getChar(string, i, len);
if (QFontEngine::getTrueTypeGlyphIndex(cmap, uc) == 0)
@@ -348,12 +327,12 @@ bool QFontEngineS60::canRender(const QChar *string, int len)
QByteArray QFontEngineS60::getSfntTable(uint tag) const
{
- return m_extensions->getSfntTable(tag);
+ return m_extras->getSfntTable(tag);
}
bool QFontEngineS60::getSfntTableData(uint tag, uchar *buffer, uint *length) const
{
- return m_extensions->getSfntTableData(tag, buffer, length);
+ return m_extras->getSfntTableData(tag, buffer, length);
}
QFontEngine::Type QFontEngineS60::type() const