diff options
author | Morten Sorvig <msorvig@trolltech.com> | 2009-09-17 04:52:40 (GMT) |
---|---|---|
committer | Morten Sorvig <msorvig@trolltech.com> | 2009-09-17 04:52:40 (GMT) |
commit | 4bf2d055aa31a7d2768538368d2984a3d594650e (patch) | |
tree | ccf2345bf6c31dee238c8486c79a842dbb214f07 /src/gui/text | |
parent | db8f89cdb4fcb0d8436db80d50221308900dca01 (diff) | |
parent | 64e03f7ada9eb6af7c65dbea7a36ebcb3f4e67fb (diff) | |
download | Qt-4bf2d055aa31a7d2768538368d2984a3d594650e.zip Qt-4bf2d055aa31a7d2768538368d2984a3d594650e.tar.gz Qt-4bf2d055aa31a7d2768538368d2984a3d594650e.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qfontmetrics.cpp | 10 | ||||
-rw-r--r-- | src/gui/text/qsyntaxhighlighter.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 6 |
3 files changed, 12 insertions, 6 deletions
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index b2784d6..ce122aa 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -528,13 +528,15 @@ int QFontMetrics::rightBearing(QChar ch) const int QFontMetrics::width(const QString &text, int len) const { int pos = text.indexOf(QLatin1Char('\x9c')); - QString txt = (pos == -1) ? text : text.left(pos); - if (len < 0) - len = txt.length(); + if (pos != -1) { + len = (len < 0) ? pos : qMin(pos, len); + } else if (len < 0) { + len = text.length(); + } if (len == 0) return 0; - QTextEngine layout(txt, d); + QTextEngine layout(text, d); layout.ignoreBidi = true; return qRound(layout.width(0, len)); } diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 41f4b4a..470c8e1 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -170,7 +170,7 @@ void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, in return; int endPosition; - QTextBlock lastBlock = doc->findBlock(from + charsAdded); + QTextBlock lastBlock = doc->findBlock(from + charsAdded + (charsRemoved > 0 ? 1 : 0)); if (lastBlock.isValid()) endPosition = lastBlock.position() + lastBlock.length(); else diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index b43bd06..81c9142 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1396,8 +1396,12 @@ void QTextEngine::itemize() const int length = layoutData->string.length(); if (!length) return; - +#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) + // ATSUI requires RTL flags to correctly identify the character stops. + bool ignore = false; +#else bool ignore = ignoreBidi; +#endif if (!ignore && option.textDirection() == Qt::LeftToRight) { ignore = true; const QChar *start = layoutData->string.unicode(); |