diff options
author | Jyri Tahtela <jyri.tahtela@nokia.com> | 2011-06-27 08:47:01 (GMT) |
---|---|---|
committer | Jyri Tahtela <jyri.tahtela@nokia.com> | 2011-06-27 08:47:01 (GMT) |
commit | 9f3fc0e9ce48c52c33c0ea9ff3f8b04d0c276267 (patch) | |
tree | e7d472a44f7b1c95961f8f31d792e8a04cf66c34 /src/gui/text/qtextengine.cpp | |
parent | f078275a2a4b2a279a6fcc24df3c21fe8b21f007 (diff) | |
parent | 36a464681a349a0915f821786b4617695c1d02d4 (diff) | |
download | Qt-9f3fc0e9ce48c52c33c0ea9ff3f8b04d0c276267.zip Qt-9f3fc0e9ce48c52c33c0ea9ff3f8b04d0c276267.tar.gz Qt-9f3fc0e9ce48c52c33c0ea9ff3f8b04d0c276267.tar.bz2 |
Merge remote-tracking branch 'qt/4.8'
Diffstat (limited to 'src/gui/text/qtextengine.cpp')
-rw-r--r-- | src/gui/text/qtextengine.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index e8e6c98..8ddf3eb 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -319,6 +319,26 @@ static void appendItems(QScriptAnalysis *analysis, int &start, int &stop, const start = stop; } +static QChar::Direction skipBoundryNeutrals(QScriptAnalysis *analysis, + const ushort *unicode, int length, + int &sor, int &eor, QBidiControl &control) +{ + QChar::Direction dir; + int level = sor > 0 ? analysis[sor - 1].bidiLevel : control.level; + while (sor < length) { + dir = QChar::direction(unicode[sor]); + // Keep skipping DirBN as if it doesn't exist + if (dir != QChar::DirBN) + break; + analysis[sor++].bidiLevel = level; + } + + eor = sor; + if (eor == length) + dir = control.basicDirection(); + + return dir; +} // creates the next QScript items. static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiControl &control) @@ -430,8 +450,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon case QChar::DirAN: if (eor >= 0) { appendItems(analysis, sor, eor, control, dir); - dir = eor < length ? QChar::direction(unicode[eor]) : control.basicDirection(); - status.eor = dir; + status.eor = dir = skipBoundryNeutrals(analysis, unicode, length, sor, eor, control); } else { eor = current; status.eor = dir; } @@ -455,8 +474,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon } eor = current - 1; appendItems(analysis, sor, eor, control, dir); - dir = eor < length ? QChar::direction(unicode[eor]) : control.basicDirection(); - status.eor = dir; + status.eor = dir = skipBoundryNeutrals(analysis, unicode, length, sor, eor, control); } else { if(status.eor != QChar::DirL) { appendItems(analysis, sor, eor, control, dir); |