diff options
author | Liang Qi <liang.qi@nokia.com> | 2011-07-29 15:43:07 (GMT) |
---|---|---|
committer | Liang Qi <liang.qi@nokia.com> | 2011-07-29 15:43:07 (GMT) |
commit | 29a5089b83b1b43ecf2c746dac8cadbbe4385553 (patch) | |
tree | 69a3f39667e0ff22a3d7507fafcdb7c9cd219daf /src | |
parent | c9f0c578bbaf73211ad4729e1496e53867a641c9 (diff) | |
parent | 174e01a16aba71cfaa7b095be6430f8e4a89d0b8 (diff) | |
download | Qt-29a5089b83b1b43ecf2c746dac8cadbbe4385553.zip Qt-29a5089b83b1b43ecf2c746dac8cadbbe4385553.tar.gz Qt-29a5089b83b1b43ecf2c746dac8cadbbe4385553.tar.bz2 |
Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7
Conflicts:
src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
src/gui/text/qfont_s60.cpp
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/dialogs/qfontdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qcocoasharedwindowmethods_mac_p.h | 6 | ||||
-rw-r--r-- | src/gui/text/qfont_s60.cpp | 36 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_s60.cpp | 38 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 18 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 19 |
6 files changed, 88 insertions, 31 deletions
diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp index 6a646ff..34b6317 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/gui/dialogs/qfontdialog.cpp @@ -160,7 +160,7 @@ QFontDialog::QFontDialog(QWidget *parent) \since 4.5 Constructs a standard font dialog with the given \a parent and specified - \a initial color. + \a initial font. */ QFontDialog::QFontDialog(const QFont &initial, QWidget *parent) : QDialog(*new QFontDialogPrivate, parent, DefaultWindowFlags) diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h index f5a93d9..8c194cc 100644 --- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h +++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h @@ -347,7 +347,7 @@ QT_END_NAMESPACE QWidget *qwidget = QApplication::widgetAt(globalPoint); *currentDragTarget() = qwidget; if (!qwidget) - return [super draggingEntered:sender]; + return NSDragOperationNone; if (qwidget->testAttribute(Qt::WA_DropSiteRegistered) == false) return NSDragOperationNone; @@ -413,7 +413,7 @@ QT_END_NAMESPACE QWidget *qwidget = QApplication::widgetAt(globalPoint); if (!qwidget) - return [super draggingEntered:sender]; + return NSDragOperationNone; // First, check if the widget under the mouse has changed since the // last drag move events. If so, we need to change target, and dispatch @@ -500,7 +500,7 @@ QT_END_NAMESPACE QWidget *qwidget = *currentDragTarget(); if (!qwidget) - return [super draggingExited:sender]; + return; if (dropData) { QDragLeaveEvent de; diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp index 0fc8a97..76133fa 100644 --- a/src/gui/text/qfont_s60.cpp +++ b/src/gui/text/qfont_s60.cpp @@ -49,8 +49,6 @@ QT_BEGIN_NAMESPACE #ifdef QT_NO_FREETYPE Q_GLOBAL_STATIC(QMutex, lastResortFamilyMutex); -#endif // QT_NO_FREETYPE - extern QStringList qt_symbian_fontFamiliesOnFontServer(); // qfontdatabase_s60.cpp Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, fontFamiliesOnFontServer, { // We are only interested in the initial font families. No Application fonts. @@ -58,6 +56,25 @@ Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, fontFamiliesOnFontServer, { x->append(qt_symbian_fontFamiliesOnFontServer()); }); +extern bool qt_symbian_isLinkedFont(const TDesC &typefaceName); // qfontdatabase_s60.cpp + +static QString classicalSymbianSystemFont() +{ + static QString font; + if (font.isEmpty()) { + static const char* const classicSymbianSystemFonts[] = { "Nokia Sans S60", "Series 60 Sans" }; + for (int i = 0; i < sizeof classicSymbianSystemFonts / sizeof classicSymbianSystemFonts[0]; ++i) { + const QString classicFont = QLatin1String(classicSymbianSystemFonts[i]); + if (fontFamiliesOnFontServer()->contains(classicFont)) { + font = classicFont; + break; + } + } + } + return font; +} +#endif // QT_NO_FREETYPE + QString QFont::lastResortFont() const { // Symbian's font Api does not distinguish between font and family. @@ -85,6 +102,10 @@ QString QFont::lastResortFamily() const S60->screenDevice()->ReleaseFont(font); lock.relock(); + + // We must not return a Symbian Linked Font. See QTBUG-20007 + if (qt_symbian_isLinkedFont(spec.iTypeface.iName) && !classicalSymbianSystemFont().isEmpty()) + family = classicalSymbianSystemFont(); } return family; #else // QT_NO_FREETYPE @@ -117,14 +138,9 @@ QString QFont::defaultFamily() const { #ifdef QT_NO_FREETYPE switch(d->request.styleHint) { - case QFont::SansSerif: { - static const char* const preferredSansSerif[] = {"Nokia Sans S60", "Series 60 Sans"}; - for (int i = 0; i < sizeof preferredSansSerif / sizeof preferredSansSerif[0]; ++i) { - const QString sansSerif = QLatin1String(preferredSansSerif[i]); - if (fontFamiliesOnFontServer()->contains(sansSerif)) - return sansSerif; - } - } + case QFont::SansSerif: + if (!classicalSymbianSystemFont().isEmpty()) + return classicalSymbianSystemFont(); // No break. Intentional fall through. default: return lastResortFamily(); diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 2f4d055..ed336d9 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -58,8 +58,41 @@ #endif // SYMBIAN_ENABLE_SPLIT_HEADERS #endif // QT_NO_FREETYPE +#ifndef SYMBIAN_VERSION_9_4 +#define SYMBIAN_LINKEDFONTS_SUPPORTED +#endif // !SYMBIAN_VERSION_9_4 + +#ifdef SYMBIAN_LINKEDFONTS_SUPPORTED +#include <linkedfonts.h> +#endif // SYMBIAN_LINKEDFONTS_SUPPORTED + QT_BEGIN_NAMESPACE +#ifdef SYMBIAN_LINKEDFONTS_SUPPORTED +static bool isLinkedFontL(const TDesC &aTypefaceName) +{ + CLinkedTypefaceSpecification *linkedspec = CLinkedTypefaceSpecification::NewLC(aTypefaceName); + CFbsTypefaceStore *tfs = CFbsTypefaceStore::NewL(NULL); + CleanupStack::PushL(tfs); + linkedspec->FetchLinkedTypefaceSpecificationL(*tfs); + CleanupStack::PopAndDestroy(tfs); + CleanupStack::PopAndDestroy(linkedspec); + return true; +} +#endif // SYMBIAN_LINKEDFONTS_SUPPORTED + +bool qt_symbian_isLinkedFont(const TDesC &typefaceName) // Also used in qfont_s60.cpp +{ + bool isLinkedFont = false; +#ifdef SYMBIAN_LINKEDFONTS_SUPPORTED + if (RFbsSession::Connect() == KErrNone) { + TRAP_IGNORE(isLinkedFont = isLinkedFontL(typefaceName)); + RFbsSession::Disconnect(); + } +#endif // SYMBIAN_LINKEDFONTS_SUPPORTED + return isLinkedFont; +} + QStringList qt_symbian_fontFamiliesOnFontServer() // Also used in qfont_s60.cpp { QStringList result; @@ -477,7 +510,10 @@ static bool registerScreenDeviceFont(int screenDeviceFontIndex, const QSymbianFontDatabaseExtrasImplementation *dbExtras) { TTypefaceSupport typefaceSupport; - S60->screenDevice()->TypefaceSupport(typefaceSupport, screenDeviceFontIndex); + S60->screenDevice()->TypefaceSupport(typefaceSupport, screenDeviceFontIndex); + + if (qt_symbian_isLinkedFont(typefaceSupport.iTypeface.iName)) + return false; QString familyName((const QChar*)typefaceSupport.iTypeface.iName.Ptr(), typefaceSupport.iTypeface.iName.Length()); if (qt_symbian_fontNameHasAppFontMarker(familyName)) { diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 41ea56a..093b43d 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1632,19 +1632,13 @@ bool QTextEngine::isRightToLeft() const int QTextEngine::findItem(int strPos) const { itemize(); - int left = 0; - int right = layoutData->items.size()-1; - while(left <= right) { - int middle = ((right-left)/2)+left; - if (strPos > layoutData->items[middle].position) - left = middle+1; - else if(strPos < layoutData->items[middle].position) - right = middle-1; - else { - return middle; - } + + int item; + for (item = layoutData->items.size()-1; item > 0; --item) { + if (layoutData->items[item].position <= strPos) + break; } - return right; + return item; } QFixed QTextEngine::width(int from, int len) const diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 3f0b9e8..4fd6ddf 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1591,6 +1591,7 @@ namespace { QFixed minimumRightBearing; QFontEngine *fontEngine; + QFontEngine *previousFontEngine; const unsigned short *logClusters; bool manualWrap; @@ -1611,12 +1612,19 @@ namespace { return glyphs.glyphs[logClusters[currentPosition - 1]]; } - inline void saveCurrentGlyph() + inline void resetPreviousGlyph() { previousGlyph = 0; + previousFontEngine = 0; + } + + inline void saveCurrentGlyph() + { + resetPreviousGlyph(); if (currentPosition > 0 && logClusters[currentPosition - 1] < glyphs.numGlyphs) { previousGlyph = currentGlyph(); // needed to calculate right bearing later + previousFontEngine = fontEngine; } } @@ -1636,8 +1644,11 @@ namespace { inline void adjustPreviousRightBearing() { - if (previousGlyph > 0) - adjustRightBearing(previousGlyph); + if (previousGlyph > 0 && previousFontEngine) { + qreal rb; + previousFontEngine->getGlyphBearings(previousGlyph, 0, &rb); + rightBearing = qMin(QFixed(), QFixed::fromReal(rb)); + } } inline void resetRightBearing() @@ -1728,7 +1739,7 @@ void QTextLine::layout_helper(int maxGlyphs) lbh.currentPosition = line.from; int end = 0; lbh.logClusters = eng->layoutData->logClustersPtr; - lbh.previousGlyph = 0; + lbh.resetPreviousGlyph(); while (newItem < eng->layoutData->items.size()) { lbh.resetRightBearing(); |