diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2010-06-05 19:03:52 (GMT) |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2010-06-09 20:21:38 (GMT) |
commit | 17427887a2847acc74c61424e812aca0fea23226 (patch) | |
tree | 99bd84d76c6000e127dc5a8571df017711f5dc33 /src/corelib/tools/qstring.cpp | |
parent | a1f7df67056c24b8b23393401953859f6e59417e (diff) | |
download | Qt-17427887a2847acc74c61424e812aca0fea23226.zip Qt-17427887a2847acc74c61424e812aca0fea23226.tar.gz Qt-17427887a2847acc74c61424e812aca0fea23226.tar.bz2 |
Fix QString::isRightToLeft() to conform with Unicode Bidi algorithm
Rules P2 and P3 demand us to ignore the LRE/LRO/RLE/RLO
characters for determining the paragraph direction.
Task-Number: Part of QT-3292
Diffstat (limited to 'src/corelib/tools/qstring.cpp')
-rw-r--r-- | src/corelib/tools/qstring.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 1172a7b..1d5fab3 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -6916,20 +6916,23 @@ void QString::updateProperties() const p++; } - p = d->data; - d->righttoleft = false; + d->righttoleft = isRightToLeft(); + d->clean = true; +} + +bool QString::isRightToLeft() const +{ + ushort *p = d->data; + const ushort * const end = p + d->size; + bool righttoleft = false; while (p < end) { switch(QChar::direction(*p)) { case QChar::DirL: - case QChar::DirLRO: - case QChar::DirLRE: goto end; case QChar::DirR: case QChar::DirAL: - case QChar::DirRLO: - case QChar::DirRLE: - d->righttoleft = true; + righttoleft = true; goto end; default: break; @@ -6937,8 +6940,7 @@ void QString::updateProperties() const ++p; } end: - d->clean = true; - return; + return righttoleft; } /*! \fn bool QString::isSimpleText() const |