summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_s60.cpp
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@nokia.com>2011-01-24 21:43:03 +0100
committerAlessandro Portale <alessandro.portale@nokia.com>2011-01-25 00:32:44 +0100
commitcfb7c16d738993fc8a594361f4bdf10e24fa754a (patch)
tree222b687f74fb4ecaa39880ae0e6b26d5b3557f23 /src/gui/text/qfontengine_s60.cpp
parent53dbf490b5490d6e75aac90969bba8f41a8f718a (diff)
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
Diffstat (limited to 'src/gui/text/qfontengine_s60.cpp')
-rw-r--r--src/gui/text/qfontengine_s60.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index b572cdd049..f2b6f5c75c 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -243,10 +243,13 @@ static inline unsigned int getChar(const QChar *str, int &i, const int len)
return uc;
}
+extern QString qt_symbian_fontNameWithAppFontMarker(const QString &fontName); // qfontdatabase_s60.cpp
+
CFont *QFontEngineS60::fontWithSize(qreal size) const
{
CFont *result = 0;
- TFontSpec fontSpec(qt_QString2TPtrC(QFontEngine::fontDef.family), TInt(size));
+ const QString family = qt_symbian_fontNameWithAppFontMarker(QFontEngine::fontDef.family);
+ TFontSpec fontSpec(qt_QString2TPtrC(family), TInt(size));
fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
fontSpec.iFontStyle.SetPosture(QFontEngine::fontDef.style == QFont::StyleNormal?EPostureUpright:EPostureItalic);
fontSpec.iFontStyle.SetStrokeWeight(QFontEngine::fontDef.weight > QFont::Normal?EStrokeWeightBold:EStrokeWeightNormal);