diff options
author | Alessandro Portale <alessandro.portale@nokia.com> | 2011-01-19 12:16:13 (GMT) |
---|---|---|
committer | Alessandro Portale <alessandro.portale@nokia.com> | 2011-01-19 12:27:14 (GMT) |
commit | 770fb729929764a1f1c5fbd3d54714cf811c81e0 (patch) | |
tree | a7ac55a60b2d1763d99ae811faa088c92cf3423f /tests/auto/qfontdatabase | |
parent | 11815c63abeaf2b768e0cf59a83b53ff2b160b05 (diff) | |
download | Qt-770fb729929764a1f1c5fbd3d54714cf811c81e0.zip Qt-770fb729929764a1f1c5fbd3d54714cf811c81e0.tar.gz Qt-770fb729929764a1f1c5fbd3d54714cf811c81e0.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
Diffstat (limited to 'tests/auto/qfontdatabase')
-rw-r--r-- | tests/auto/qfontdatabase/tst_qfontdatabase.cpp | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp index ead000c..8b6f621 100644 --- a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp @@ -191,9 +191,6 @@ void tst_QFontDatabase::addAppFont_data() void tst_QFontDatabase::addAppFont() { -#ifdef Q_OS_SYMBIAN - QSKIP( "Symbian: Application fonts are not yet supported", SkipAll ); -#else QFETCH(bool, useMemoryFont); QSignalSpy fontDbChangedSpy(QApplication::instance(), SIGNAL(fontDatabaseChanged())); @@ -243,7 +240,6 @@ void tst_QFontDatabase::addAppFont() QCOMPARE(fontDbChangedSpy.count(), 2); QVERIFY(db.families() == oldFamilies); -#endif } QTEST_MAIN(tst_QFontDatabase) |