summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2010-12-12 16:33:12 (GMT)
committerQt Commercial Integration <QtCommercial@digia.com>2012-01-31 10:24:46 (GMT)
commit48138e019036f5bd65e16557ad2a9414292b850d (patch)
treebcbd5571f2bd8f6927d98dfb83f2088d2ac4eb13
parent152a14cd73e478685833dd0c8ae29583d898ce82 (diff)
downloadQt-48138e019036f5bd65e16557ad2a9414292b850d.zip
Qt-48138e019036f5bd65e16557ad2a9414292b850d.tar.gz
Qt-48138e019036f5bd65e16557ad2a9414292b850d.tar.bz2
Move advances for control character in Indic syllable shaping
When handling control characters (ZWJ, ZWNJ) in Indic syllables, we only moved glyphs and attributes of the item, advances should also be moved forward, otherwise we will use the advance of ZWJ/ ZWNJ for the part of syllable, which is normally zero, it results some positioning problems. Task-number: QTBUG-14204 Reviewed-by: Lars Knoll
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp1
-rw-r--r--tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp17
2 files changed, 18 insertions, 0 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
index 237c9ae..b3f9577 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
@@ -1683,6 +1683,7 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv
}
item->glyphs[j] = item->glyphs[i];
item->attributes[j] = item->attributes[i];
+ item->advances[j] = item->advances[i];
++i;
++j;
}
diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp
index 3c26e54..1b3645f 100644
--- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -103,6 +103,7 @@ private slots:
void khmer();
void linearB();
+ void controlInSyllable_qtbug14204();
};
tst_QTextScriptEngine::tst_QTextScriptEngine()
@@ -1111,6 +1112,22 @@ void tst_QTextScriptEngine::greek()
#endif
}
+void tst_QTextScriptEngine::controlInSyllable_qtbug14204()
+{
+ QString s;
+ s.append(QChar(0x0915));
+ s.append(QChar(0x094d));
+ s.append(QChar(0x200d));
+ s.append(QChar(0x0915));
+
+ QTextLayout layout(s);
+ QTextEngine *e = layout.d;
+ e->itemize();
+ e->shape(0);
+
+ QVERIFY(e->layoutData->items[0].num_glyphs == 2);
+ QVERIFY(e->layoutData->glyphLayout.advances_x[1] != 0);
+}
QTEST_MAIN(tst_QTextScriptEngine)
#include "tst_qtextscriptengine.moc"