equal
deleted
inserted
replaced
38 ** $QT_END_LICENSE$ |
38 ** $QT_END_LICENSE$ |
39 ** |
39 ** |
40 ****************************************************************************/ |
40 ****************************************************************************/ |
41 |
41 |
42 #include "qfont.h" |
42 #include "qfont.h" |
|
43 #include "qfont_p.h" |
43 #include <private/qt_s60_p.h> |
44 #include <private/qt_s60_p.h> |
44 #include <private/qpixmap_s60_p.h> |
45 #include <private/qpixmap_s60_p.h> |
45 #include "qmutex.h" |
46 #include "qmutex.h" |
46 |
47 |
47 QT_BEGIN_NAMESPACE |
48 QT_BEGIN_NAMESPACE |
48 |
49 |
49 #if 1 |
|
50 #ifdef QT_NO_FREETYPE |
50 #ifdef QT_NO_FREETYPE |
51 Q_GLOBAL_STATIC(QMutex, lastResortFamilyMutex); |
51 Q_GLOBAL_STATIC(QMutex, lastResortFamilyMutex); |
|
52 Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, fontFamiliesOnFontServer, { |
|
53 QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); |
|
54 const int numTypeFaces = S60->screenDevice()->NumTypefaces(); |
|
55 for (int i = 0; i < numTypeFaces; i++) { |
|
56 TTypefaceSupport typefaceSupport; |
|
57 S60->screenDevice()->TypefaceSupport(typefaceSupport, i); |
|
58 const QString familyName((const QChar *)typefaceSupport.iTypeface.iName.Ptr(), typefaceSupport.iTypeface.iName.Length()); |
|
59 x->append(familyName); |
|
60 } |
|
61 lock.relock(); |
|
62 }); |
52 #endif // QT_NO_FREETYPE |
63 #endif // QT_NO_FREETYPE |
53 |
64 |
54 QString QFont::lastResortFamily() const |
65 QString QFont::lastResortFamily() const |
55 { |
66 { |
56 #ifdef QT_NO_FREETYPE |
67 #ifdef QT_NO_FREETYPE |
68 S60->screenDevice()->ReleaseFont(font); |
79 S60->screenDevice()->ReleaseFont(font); |
69 |
80 |
70 lock.relock(); |
81 lock.relock(); |
71 } |
82 } |
72 return family; |
83 return family; |
73 #else |
84 #else // QT_NO_FREETYPE |
74 // For the FreeType case we just hard code the face name, since otherwise on |
85 // For the FreeType case we just hard code the face name, since otherwise on |
75 // East Asian systems we may get a name for a stroke based (non-ttf) font. |
86 // East Asian systems we may get a name for a stroke based (non-ttf) font. |
76 |
87 |
77 // TODO: Get the type face name in a proper way |
88 // TODO: Get the type face name in a proper way |
78 |
89 |
80 User::Language() == ELangJapanese || User::Language() == ELangPrcChinese; |
91 User::Language() == ELangJapanese || User::Language() == ELangPrcChinese; |
81 |
92 |
82 return QLatin1String(isJapaneseOrChineseSystem?"Heisei Kaku Gothic S60":"Series 60 Sans"); |
93 return QLatin1String(isJapaneseOrChineseSystem?"Heisei Kaku Gothic S60":"Series 60 Sans"); |
83 #endif // QT_NO_FREETYPE |
94 #endif // QT_NO_FREETYPE |
84 } |
95 } |
85 #else // 0 |
|
86 QString QFont::lastResortFamily() const |
|
87 { |
|
88 return QLatin1String("Series 60 Sans"); |
|
89 } |
|
90 #endif // 0 |
|
91 |
96 |
92 QString QFont::defaultFamily() const |
97 QString QFont::defaultFamily() const |
93 { |
98 { |
|
99 #ifdef QT_NO_FREETYPE |
|
100 switch(d->request.styleHint) { |
|
101 case QFont::SansSerif: { |
|
102 static const char* const preferredSansSerif[] = {"Nokia Sans S60", "Series 60 Sans"}; |
|
103 for (int i = 0; i < sizeof preferredSansSerif / sizeof preferredSansSerif[0]; ++i) { |
|
104 const QString sansSerif = QLatin1String(preferredSansSerif[i]); |
|
105 if (fontFamiliesOnFontServer()->contains(sansSerif)) |
|
106 return sansSerif; |
|
107 } |
|
108 } |
|
109 // No break. Intentional fall through. |
|
110 default: |
|
111 return lastResortFamily(); |
|
112 } |
|
113 #endif // QT_NO_FREETYPE |
94 return lastResortFamily(); |
114 return lastResortFamily(); |
95 } |
115 } |
96 |
116 |
97 QT_END_NAMESPACE |
117 QT_END_NAMESPACE |