diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qfontengine_s60.cpp | 30 | ||||
-rw-r--r-- | src/gui/text/qfontengine_s60_p.h | 2 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 3ea084b..c9ff661 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -79,6 +79,31 @@ QByteArray QFontEngineS60Extensions::getSfntTable(uint tag) const return result; } +bool QFontEngineS60Extensions::getSfntTableData(uint tag, uchar *buffer, uint *length) const +{ + if (!m_trueTypeExtension->HasTrueTypeTable(tag)) + return false; + + bool result = true; + TInt error = KErrNone; + TInt tableByteLength; + TAny *table = + q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength)); + + if (error != KErrNone) { + return false; + } else if (*length > 0 && *length < tableByteLength) { + result = false; // Caller did not allocate enough memory + } else { + *length = tableByteLength; + if (buffer) + qMemCopy(buffer, table, tableByteLength); + } + + m_trueTypeExtension->ReleaseTrueTypeTable(table); + return result; +} + const unsigned char *QFontEngineS60Extensions::cmap() const { if (!m_cmap) { @@ -326,6 +351,11 @@ QByteArray QFontEngineS60::getSfntTable(uint tag) const return m_extensions->getSfntTable(tag); } +bool QFontEngineS60::getSfntTableData(uint tag, uchar *buffer, uint *length) const +{ + return m_extensions->getSfntTableData(tag, buffer, length); +} + QFontEngine::Type QFontEngineS60::type() const { return QFontEngine::S60FontEngine; diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h index 5834cc4..a80af4d 100644 --- a/src/gui/text/qfontengine_s60_p.h +++ b/src/gui/text/qfontengine_s60_p.h @@ -69,6 +69,7 @@ public: QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font); QByteArray getSfntTable(uint tag) const; + bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; const unsigned char *cmap() const; QPainterPath glyphOutline(glyph_t glyph) const; CFont *fontOwner() const; @@ -106,6 +107,7 @@ public: qreal minRightBearing() const { return 0; } QByteArray getSfntTable(uint tag) const; + bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; static qreal pixelsToPoints(qreal pixels, Qt::Orientation orientation = Qt::Horizontal); static qreal pointsToPixels(qreal points, Qt::Orientation orientation = Qt::Horizontal); |