diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2009-10-30 02:22:07 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-10-30 02:22:07 (GMT) |
commit | 8d1a520f2683289647f95d5661a31324f87f0b55 (patch) | |
tree | c078d5bbd9ae783dc6e1c120dbb6dcdb17fd3f5e | |
parent | a30d0c2e97a86bfb742b3ce9ef952f4a35e9ecd0 (diff) | |
parent | 4204fdcc04e20eabd19704f2235ba06afa84605e (diff) | |
download | Qt-8d1a520f2683289647f95d5661a31324f87f0b55.zip Qt-8d1a520f2683289647f95d5661a31324f87f0b55.tar.gz Qt-8d1a520f2683289647f95d5661a31324f87f0b55.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 2 | ||||
-rw-r--r-- | src/gui/text/qtextengine_mac.cpp | 77 | ||||
-rw-r--r-- | tests/auto/qtextlayout/tst_qtextlayout.cpp | 14 |
3 files changed, 53 insertions, 40 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index ef71194..db11815 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2872,6 +2872,7 @@ void QWidgetPrivate::setCursor_sys(const QCursor &) #else Q_Q(QWidget); if (q->testAttribute(Qt::WA_WState_Created)) { + QMacCocoaAutoReleasePool pool; [qt_mac_window_for(q) invalidateCursorRectsForView:qt_mac_nativeview_for(q)]; } #endif @@ -2884,6 +2885,7 @@ void QWidgetPrivate::unsetCursor_sys() #else Q_Q(QWidget); if (q->testAttribute(Qt::WA_WState_Created)) { + QMacCocoaAutoReleasePool pool; [qt_mac_window_for(q) invalidateCursorRectsForView:qt_mac_nativeview_for(q)]; } #endif diff --git a/src/gui/text/qtextengine_mac.cpp b/src/gui/text/qtextengine_mac.cpp index 4f20094..e35f9e0 100644 --- a/src/gui/text/qtextengine_mac.cpp +++ b/src/gui/text/qtextengine_mac.cpp @@ -595,53 +595,50 @@ void QTextEngine::shapeTextMac(int item) const str = reinterpret_cast<const QChar *>(uc); } - while (true) { - ensureSpace(num_glyphs); - num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; - - QGlyphLayout g = availableGlyphs(&si); - g.numGlyphs = num_glyphs; - unsigned short *log_clusters = logClusters(&si); - - if (fe->stringToCMap(str, - len, - &g, - &num_glyphs, - flags, - log_clusters, - attributes())) { - - heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - break; - } + ensureSpace(num_glyphs); + num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; + + QGlyphLayout g = availableGlyphs(&si); + g.numGlyphs = num_glyphs; + unsigned short *log_clusters = logClusters(&si); + + bool stringToCMapFailed = false; + if (!fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, attributes())) { + ensureSpace(num_glyphs); + stringToCMapFailed = fe->stringToCMap(str, len, &g, &num_glyphs, flags, log_clusters, + attributes()); } - si.num_glyphs = num_glyphs; + if (!stringToCMapFailed) { + heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - layoutData->used += si.num_glyphs; + si.num_glyphs = num_glyphs; - QGlyphLayout g = shapedGlyphs(&si); + layoutData->used += si.num_glyphs; - if (si.analysis.script == QUnicodeTables::Arabic) { - QVarLengthArray<QArabicProperties> props(len + 2); - QArabicProperties *properties = props.data(); - int f = si.position; - int l = len; - if (f > 0) { - --f; - ++l; - ++properties; - } - if (f + l < layoutData->string.length()) { - ++l; - } - qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data()); + QGlyphLayout g = shapedGlyphs(&si); - unsigned short *log_clusters = logClusters(&si); + if (si.analysis.script == QUnicodeTables::Arabic) { + QVarLengthArray<QArabicProperties> props(len + 2); + QArabicProperties *properties = props.data(); + int f = si.position; + int l = len; + if (f > 0) { + --f; + ++l; + ++properties; + } + if (f + l < layoutData->string.length()) { + ++l; + } + qt_getArabicProperties((const unsigned short *)(layoutData->string.unicode()+f), l, props.data()); - for (int i = 0; i < len; ++i) { - int gpos = log_clusters[i]; - g.attributes[gpos].justification = properties[i].justification; + unsigned short *log_clusters = logClusters(&si); + + for (int i = 0; i < len; ++i) { + int gpos = log_clusters[i]; + g.attributes[gpos].justification = properties[i].justification; + } } } diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index a5fed4e..b02a704 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -119,6 +119,7 @@ private slots: void smallTextLengthWordWrap(); void smallTextLengthWrapAtWordBoundaryOrAnywhere(); void testLineBreakingAllSpaces(); + void lineWidthFromBOM(); private: @@ -1277,5 +1278,18 @@ void tst_QTextLayout::widthOfTabs() QCOMPARE(qRound(engine.width(0, 5)), qRound(engine.boundingBox(0, 5).width)); } +void tst_QTextLayout::lineWidthFromBOM() +{ + const QString string(QChar(0xfeff)); // BYTE ORDER MARK + QTextLayout layout(string); + layout.beginLayout(); + QTextLine line = layout.createLine(); + line.setLineWidth(INT_MAX / 256); + layout.endLayout(); + + // Don't spin into an infinite loop + } + + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" |