summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2010-06-05 20:12:56 (GMT)
committerLars Knoll <lars.knoll@nokia.com>2010-06-09 22:08:04 (GMT)
commit2ae3d17883c0b24f7f4a5a1ea763105a2c8a7342 (patch)
tree00c96a4c80a234ad6a3c971dcd617176061274f3 /src
parent7b0f00e8c8a4ec541dba510debcf786c7edb7fae (diff)
downloadQt-2ae3d17883c0b24f7f4a5a1ea763105a2c8a7342.zip
Qt-2ae3d17883c0b24f7f4a5a1ea763105a2c8a7342.tar.gz
Qt-2ae3d17883c0b24f7f4a5a1ea763105a2c8a7342.tar.bz2
correctly initialize the bidi level in the text engine
If the text options doesn't specify the layout direction, determine it from the content. Reviewed-by: Simon Hausmann
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextengine.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 3486264..191508c 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1404,7 +1404,20 @@ void QTextEngine::itemize() const
#else
bool ignore = ignoreBidi;
#endif
- if (!ignore && option.textDirection() == Qt::LeftToRight) {
+
+ bool rtl = false;
+ switch (option.textDirection()) {
+ case Qt::LeftToRight:
+ break;
+ case Qt::RightToLeft:
+ rtl = true;
+ break;
+ case Qt::LayoutDirectionAuto:
+ rtl = layoutData->string.isRightToLeft();
+ break;
+ }
+
+ if (!ignore && !rtl) {
ignore = true;
const QChar *start = layoutData->string.unicode();
const QChar * const end = start + length;
@@ -1420,7 +1433,7 @@ void QTextEngine::itemize() const
QVarLengthArray<QScriptAnalysis, 4096> scriptAnalysis(length);
QScriptAnalysis *analysis = scriptAnalysis.data();
- QBidiControl control(option.textDirection() == Qt::RightToLeft);
+ QBidiControl control(rtl);
if (ignore) {
memset(analysis, 0, length*sizeof(QScriptAnalysis));