summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontdatabase.cpp
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@nokia.com>2011-01-19 13:16:13 +0100
committerAlessandro Portale <alessandro.portale@nokia.com>2011-01-19 13:27:14 +0100
commit770fb729929764a1f1c5fbd3d54714cf811c81e0 (patch)
treea7ac55a60b2d1763d99ae811faa088c92cf3423f /src/gui/text/qfontdatabase.cpp
parent11815c63abeaf2b768e0cf59a83b53ff2b160b05 (diff)
Supporting Qt application fonts on Symbian
This patch finally implements the missing application font support on Symbian. QFontDatabase's addApplicationFont[FromData], applicationFontFamilies and removeApplicationFont are now functional and allow an application to load, use and unload fonts at run-time. The underlying Symbian API comes with some restrictions/specialties. Most of them are worked around in this patch, the missing ones are left as part of QTBUG-16514: - The font file must be a file, not a memory buffer. Web fonts and qrc fonts come as memory buffers. These buffers are saved to a temporary .ttf file and the file is loaded by the underlying Symbian API. The temporary file can only be deleted after the font is unloaded. - The font file must be in a public location in order to be loadable by Symbian. It can for example not reside in the private application directory. Therefore, all application fonts (also those that are on the file system) become a temporary .ttf file in c:\temp\. - Symbian3/PR2 will come with a font table API which provides direct access to font tables. Symbian3/PR1 and below are missing this API, therefore, an own TFontStore is (ab)used to read font tables out of a font. This patch is considering both code paths in several occasions, making the Qt Symbian font implementation significantly less maintainable. - The fonts are loaded into Symbian's central font server. Loaded fonts from different processes can have colliding font typeface names (not file names) on that server. The server does not separate loaded fonts by their origin processes. Working around such collisions is part of QTBUG-16514. The number of fonts loadable at the same time by a Qt application is limited to the random value 5. Just to prevent abuse of the font server's memory. As usual, this patch was looked at by colleagues, and it was adjusted according to the feedback. But since the bus factor for the interaction of Qt's and Symbian's font systems is 1, I reviewed this patch, myself. Task-Number: QTBUG-6611 Autotest: tst_QFontDatabase::addAppFont
Diffstat (limited to 'src/gui/text/qfontdatabase.cpp')
-rw-r--r--src/gui/text/qfontdatabase.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 5cecf08bef..637957d684 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -624,6 +624,10 @@ public:
{ }
~QFontDatabasePrivate() {
free();
+#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
+ if (symbianExtras)
+ delete symbianExtras;
+#endif
}
QtFontFamily *family(const QString &f, bool = false);
void free() {
@@ -632,12 +636,6 @@ public:
::free(families);
families = 0;
count = 0;
-#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
- if (symbianExtras) {
- delete symbianExtras;
- symbianExtras = 0;
- }
-#endif
// don't clear the memory fonts!
}
@@ -653,6 +651,10 @@ public:
QVector<FONTSIGNATURE> signatures;
#elif defined(Q_WS_MAC)
ATSFontContainerRef handle;
+#elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
+ QString temporaryFileName;
+ TInt screenDeviceFontFileId;
+ TUid fontStoreFontFileUid;
#endif
QStringList families;
};
@@ -680,7 +682,7 @@ public:
QDataStream *stream;
QStringList fallbackFamilies;
#elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE)
- const QSymbianFontDatabaseExtras *symbianExtras;
+ QSymbianFontDatabaseExtras *symbianExtras;
#endif
};