diff options
author | Alessandro Portale <alessandro.portale@nokia.com> | 2011-01-19 12:16:13 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2011-01-20 09:43:43 (GMT) |
commit | 1600d0777f12e8dd180c9b32f192284f33468934 (patch) | |
tree | a1c0955a9516ee441aaa4ada1a81641b81ba6c77 /src/gui/kernel | |
parent | 101ecddd24e194761cde0d84a421657c1206c506 (diff) | |
download | Qt-1600d0777f12e8dd180c9b32f192284f33468934.zip Qt-1600d0777f12e8dd180c9b32f192284f33468934.tar.gz Qt-1600d0777f12e8dd180c9b32f192284f33468934.tar.bz2 |
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
(cherry picked from commit 770fb729929764a1f1c5fbd3d54714cf811c81e0)
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 6b8f309..573af85 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1617,7 +1617,7 @@ void qt_init(QApplicationPrivate * /* priv */, int) qRegisterMetaType<WId>("WId"); } -extern void qt_cleanup_symbianFontDatabaseExtras(); // qfontdatabase_s60.cpp +extern void qt_cleanup_symbianFontDatabase(); // qfontdatabase_s60.cpp /***************************************************************************** qt_cleanup() - cleans up when the application is finished @@ -1631,7 +1631,7 @@ void qt_cleanup() QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles QPixmapCache::clear(); // Has to happen now, since QS60PixmapData has FBS handles - qt_cleanup_symbianFontDatabaseExtras(); + qt_cleanup_symbianFontDatabase(); // S60 structure and window server session are freed in eventdispatcher destructor as they are needed there // It's important that this happens here, before the event dispatcher gets |