Avoid possible font name collisions on fbserv
authorAlessandro Portale <alessandro.portale@nokia.com>
Mon, 24 Jan 2011 20:43:03 +0000 (21:43 +0100)
committerJason McDonald <jason.mcdonald@nokia.com>
Tue, 25 Jan 2011 08:28:56 +0000 (18:28 +1000)
commit6e49ead4a2f62f4cc951a80cd2ac6900f497b104
tree434ebd49e849e2b8fe538c7988acbcdd68df1743
parente47d310a3af2880fac7512251aee518b380b62fe
Avoid possible font name collisions on fbserv

QTBUG-6611 implemented the long awaited app font support on Symbian. One
of the problems with the underlying Symbian Api for font loading is that
all fonts go into one system wide font store on fbserv. All fonts are
visible to and accessible by every application. And there is no way to
find out if a font is an app font and whose process' app font it is. If
a font with a certain family name is already loaded on fbserv, no other
application can load its font with the same family name. If two
applications access the same font, bad things can happen (details:
QTBUG-16514).

This patch works around naming collisions on the fbserv. It also
prevents Qt applications from using other Qt applications' app fonts. It
does so by "marking" the name of the temporary ttf file before the file
gets loaded by fbserv. All font name strings in the font's 'name' table
get a marker string appended. The marker is composed by a "Q", the uid3,
and on Symbian^3|PR1&below the pid. The marker length is four characters.
When the QFontDatabase is populated, all own app font names are cleand
from the marker, so that the Qt app can use the original font name. Other
applications' app fonts are detected and filtered out of the own font
database.

Symbian's font Api supports only 24 characters as names for font
families. The name marker reduces the effective characters to 20. The
reduced name length is documented for
QFontDatabase::addApplication[FontFromData] as a note.

Since the app font feature is much safer now, it got re-enabled for
Symbian^1 and below by reverting
25ac59fcf1bb03c9af9a2c967218c96c7c77361a .

Task-number: QTBUG-16514
(cherry picked from commit cfb7c16d738993fc8a594361f4bdf10e24fa754a)
src/gui/text/qfontdatabase.cpp
src/gui/text/qfontdatabase_s60.cpp
src/gui/text/qfontengine_s60.cpp