summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-04-29 07:54:44 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-04-29 07:54:44 (GMT)
commitdcaad8949ea1c1782d27b038f08e9a728c8e3fe5 (patch)
tree3cb49a22f79c5952de4e913146659990d614cd64 /src/gui/text
parent917e4e3284a568eecfca26365cc0a545d0f4eb70 (diff)
parent6940070adb45d67a0a9186205a4914a0a6c14135 (diff)
downloadQt-dcaad8949ea1c1782d27b038f08e9a728c8e3fe5.zip
Qt-dcaad8949ea1c1782d27b038f08e9a728c8e3fe5.tar.gz
Qt-dcaad8949ea1c1782d27b038f08e9a728c8e3fe5.tar.bz2
Merge remote branch 'origin/4.6' into qt-4.7-from-4.6
All EGL-related changes from 4.6 were discarded. Conflicts: src/gui/egl/egl.pri src/gui/egl/qegl.cpp src/gui/egl/qegl_p.h src/gui/egl/qegl_stub.cpp src/gui/egl/qeglproperties_p.h src/gui/egl/qeglproperties_stub.cpp src/gui/gui.pro src/multimedia/multimedia/audio/qaudioinput_win32_p.h src/s60installs/bwins/QtGuiu.def src/s60installs/eabi/QtGuiu.def
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfont.cpp5
-rw-r--r--src/gui/text/qfontdatabase.cpp14
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp46
-rw-r--r--src/gui/text/qfontengine_s60.cpp24
-rw-r--r--src/gui/text/qfontengine_s60_p.h8
5 files changed, 48 insertions, 49 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 24887b5..21a31a3 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -2616,10 +2616,8 @@ void QFontCache::cleanup()
} QT_CATCH (const std::bad_alloc &) {
// no cache - just ignore
}
- if (cache && cache->hasLocalData()) {
- cache->localData()->clear();
+ if (cache && cache->hasLocalData())
cache->setLocalData(0);
- }
}
#endif // QT_NO_THREAD
@@ -2631,6 +2629,7 @@ QFontCache::QFontCache()
QFontCache::~QFontCache()
{
+ clear();
{
EngineDataCache::ConstIterator it = engineDataCache.constBegin(),
end = engineDataCache.constEnd();
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index ae5e9ca..ff29462 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -598,10 +598,10 @@ static QList<QFontDatabase::WritingSystem> determineWritingSystemsFromTrueTypeBi
#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
// class with virtual destructor, derived in qfontdatabase_s60.cpp
-class QFontDatabaseS60Store
+class QSymbianFontDatabaseExtras
{
public:
- virtual ~QFontDatabaseS60Store() {}
+ virtual ~QSymbianFontDatabaseExtras() {}
};
#endif
@@ -614,7 +614,7 @@ public:
, stream(0)
#endif
#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
- , s60Store(0)
+ , symbianExtras(0)
#endif
{ }
~QFontDatabasePrivate() {
@@ -628,9 +628,9 @@ public:
families = 0;
count = 0;
#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
- if (s60Store) {
- delete s60Store;
- s60Store = 0;
+ if (symbianExtras) {
+ delete symbianExtras;
+ symbianExtras = 0;
}
#endif
// don't clear the memory fonts!
@@ -675,7 +675,7 @@ public:
QDataStream *stream;
QStringList fallbackFamilies;
#elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
- const QFontDatabaseS60Store *s60Store;
+ const QSymbianFontDatabaseExtras *symbianExtras;
#endif
};
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
index ef5e0c4..3ad0806 100644
--- a/src/gui/text/qfontdatabase_s60.cpp
+++ b/src/gui/text/qfontdatabase_s60.cpp
@@ -92,22 +92,22 @@ QFileInfoList alternativeFilePaths(const QString &path, const QStringList &nameF
}
#if defined(QT_NO_FREETYPE)
-class QFontDatabaseS60StoreImplementation : public QFontDatabaseS60Store
+class QSymbianFontDatabaseExtrasImplementation : public QSymbianFontDatabaseExtras
{
public:
- QFontDatabaseS60StoreImplementation();
- ~QFontDatabaseS60StoreImplementation();
+ QSymbianFontDatabaseExtrasImplementation();
+ ~QSymbianFontDatabaseExtrasImplementation();
- const QFontEngineS60Extensions *extension(const QString &typeface) const;
+ const QSymbianTypeFaceExtras *extras(const QString &typeface) const;
private:
RHeap* m_heap;
CFontStore *m_store;
COpenFontRasterizer *m_rasterizer;
- mutable QHash<QString, const QFontEngineS60Extensions *> m_extensions;
+ mutable QHash<QString, const QSymbianTypeFaceExtras *> m_extras;
};
-QFontDatabaseS60StoreImplementation::QFontDatabaseS60StoreImplementation()
+QSymbianFontDatabaseExtrasImplementation::QSymbianFontDatabaseExtrasImplementation()
{
m_heap = User::ChunkHeap(NULL, 0x1000, 0x100000);
QT_TRAP_THROWING(
@@ -127,10 +127,10 @@ QFontDatabaseS60StoreImplementation::QFontDatabaseS60StoreImplementation()
QT_TRAP_THROWING(m_store->AddFileL(fontFilePtr));
}
}
-QFontDatabaseS60StoreImplementation::~QFontDatabaseS60StoreImplementation()
+QSymbianFontDatabaseExtrasImplementation::~QSymbianFontDatabaseExtrasImplementation()
{
- typedef QHash<QString, const QFontEngineS60Extensions *>::iterator iterator;
- for (iterator p = m_extensions.begin(); p != m_extensions.end(); ++p) {
+ typedef QHash<QString, const QSymbianTypeFaceExtras *>::iterator iterator;
+ for (iterator p = m_extras.begin(); p != m_extras.end(); ++p) {
m_store->ReleaseFont((*p)->fontOwner());
delete *p;
}
@@ -156,9 +156,9 @@ COpenFont* OpenFontFromBitmapFont(const CBitmapFont* aBitmapFont)
}
#endif // FNTSTORE_H_INLINES_SUPPORT_FMM
-const QFontEngineS60Extensions *QFontDatabaseS60StoreImplementation::extension(const QString &typeface) const
+const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(const QString &typeface) const
{
- if (!m_extensions.contains(typeface)) {
+ if (!m_extras.contains(typeface)) {
CFont* font = NULL;
TFontSpec spec(qt_QString2TPtrC(typeface), 1);
spec.iHeight = 1;
@@ -171,9 +171,9 @@ const QFontEngineS60Extensions *QFontDatabaseS60StoreImplementation::extension(c
#else
OpenFontFromBitmapFont(bitmapFont);
#endif // FNTSTORE_H_INLINES_SUPPORT_FMM
- m_extensions.insert(typeface, new QFontEngineS60Extensions(font, openFont));
+ m_extras.insert(typeface, new QSymbianTypeFaceExtras(font, openFont));
}
- return m_extensions.value(typeface);
+ return m_extras.value(typeface);
}
#else
class QFontEngineFTS60 : public QFontEngineFT
@@ -240,14 +240,14 @@ static void initializeDb()
return;
#if defined(QT_NO_FREETYPE)
- if (!db->s60Store)
- db->s60Store = new QFontDatabaseS60StoreImplementation;
+ if (!db->symbianExtras)
+ db->symbianExtras = new QSymbianFontDatabaseExtrasImplementation;
QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces();
- const QFontDatabaseS60StoreImplementation *store =
- static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store);
+ const QSymbianFontDatabaseExtrasImplementation *dbExtras =
+ static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
bool fontAdded = false;
for (int i = 0; i < numTypeFaces; i++) {
TTypefaceSupport typefaceSupport;
@@ -273,8 +273,8 @@ static void initializeDb()
style->smoothScalable = typefaceSupport.iIsScalable;
style->pixelSize(0, true);
- const QFontEngineS60Extensions *extension = store->extension(familyName);
- const QByteArray os2Table = extension->getSfntTable(MAKE_TAG('O', 'S', '/', '2'));
+ const QSymbianTypeFaceExtras *typeFaceExtras = dbExtras->extras(familyName);
+ const QByteArray os2Table = typeFaceExtras->getSfntTable(MAKE_TAG('O', 'S', '/', '2'));
const unsigned char* data = reinterpret_cast<const unsigned char*>(os2Table.constData());
const unsigned char* ulUnicodeRange = data + 42;
quint32 unicodeRange[4] = {
@@ -394,10 +394,10 @@ QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *, const QFo
QFontDef request = req;
request.family = fontFamily;
#if defined(QT_NO_FREETYPE)
- const QFontDatabaseS60StoreImplementation *store =
- static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store);
- const QFontEngineS60Extensions *extension = store->extension(fontFamily);
- fe = new QFontEngineS60(request, extension);
+ const QSymbianFontDatabaseExtrasImplementation *dbExtras =
+ static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
+ const QSymbianTypeFaceExtras *typeFaceExtras = dbExtras->extras(fontFamily);
+ fe = new QFontEngineS60(request, typeFaceExtras);
#else
QFontEngine::FaceId faceId;
const QtFontFamily * const reqQtFontFamily = db->family(fontFamily);
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index e557f56..a9960e4 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -53,7 +53,7 @@
QT_BEGIN_NAMESPACE
-QFontEngineS60Extensions::QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font)
+QSymbianTypeFaceExtras::QSymbianTypeFaceExtras(CFont* fontOwner, COpenFont *font)
: m_font(font)
, m_cmap(0)
, m_symbolCMap(false)
@@ -68,7 +68,7 @@ QFontEngineS60Extensions::QFontEngineS60Extensions(CFont* fontOwner, COpenFont *
Q_ASSERT(m_shapingExtension && 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 +79,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 +104,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,7 +114,7 @@ const unsigned char *QFontEngineS60Extensions::cmap() const
return m_cmap;
}
-QPainterPath QFontEngineS60Extensions::glyphOutline(glyph_t glyph) const
+QPainterPath QSymbianTypeFaceExtras::glyphOutline(glyph_t glyph) const
{
QPainterPath result;
QPolygonF polygon;
@@ -134,7 +134,7 @@ QPainterPath QFontEngineS60Extensions::glyphOutline(glyph_t glyph) const
return result;
}
-CFont *QFontEngineS60Extensions::fontOwner() const
+CFont *QSymbianTypeFaceExtras::fontOwner() const
{
return m_fontOwner;
}
@@ -192,8 +192,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,7 +220,7 @@ 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);
@@ -339,7 +339,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)
@@ -350,12 +350,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
diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h
index a80af4d..b6b117f 100644
--- a/src/gui/text/qfontengine_s60_p.h
+++ b/src/gui/text/qfontengine_s60_p.h
@@ -63,10 +63,10 @@ class CFont;
QT_BEGIN_NAMESPACE
// ..gives us access to truetype tables, UTF-16<->GlyphID mapping, and glyph outlines
-class QFontEngineS60Extensions
+class QSymbianTypeFaceExtras
{
public:
- QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font);
+ QSymbianTypeFaceExtras(CFont* fontOwner, COpenFont *font);
QByteArray getSfntTable(uint tag) const;
bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
@@ -87,7 +87,7 @@ private:
class QFontEngineS60 : public QFontEngine
{
public:
- QFontEngineS60(const QFontDef &fontDef, const QFontEngineS60Extensions *extensions);
+ QFontEngineS60(const QFontDef &fontDef, const QSymbianTypeFaceExtras *extras);
~QFontEngineS60();
bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
@@ -128,7 +128,7 @@ private:
CFont *fontWithSize(qreal size) const;
static void releaseFont(CFont *&font);
- const QFontEngineS60Extensions *m_extensions;
+ const QSymbianTypeFaceExtras *m_extras;
CFont* m_originalFont;
const qreal m_originalFontSizeInPixels;
CFont* m_scaledFont;