diff options
author | John Tapsell <john.tapsell.ext@basyskom.com> | 2012-02-08 10:12:21 +0000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-04 23:20:00 +0100 |
commit | 39c73a8d66c05fb792dac722a88b745eab90feda (patch) | |
tree | aa5461ab8a680bb9fda0124a5b1eb7f264ce10c7 /tests/auto | |
parent | 656fab5e848fd14e5d00536a4babbb2f33dbcfb7 (diff) | |
download | qt4-tools-39c73a8d66c05fb792dac722a88b745eab90feda.tar.gz |
Harfbuzz-shaper - fix incorrect logClusters being set in HB_OpenTypePosition
After shaping in HB_OpenTypePosition, when we come to calculate the new
logClusters array we have to take into account that the glyphs passed in
are not a 1 to 1 correspondance with the original string, because some
shaping might have already been done. So we must use the old
logClusters values (stored in tmpLogClusters) to map from the glyphs
passed in back to the original string.
This fixes visual word wrapping problems in thai
Change-Id: I384dfa98f0946e9e074728f89542acb2b6b6bc27
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp index 3fec5b66b8..113f110757 100644 --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp @@ -1142,7 +1142,7 @@ void tst_QTextScriptEngine::controlInSyllable_qtbug14204() e->itemize(); e->shape(0); - QVERIFY(e->layoutData->items[0].num_glyphs == 2); + QCOMPARE(e->layoutData->items[0].num_glyphs, (unsigned short)2); QVERIFY(e->layoutData->glyphLayout.advances_x[1] != 0); #else QSKIP("X11 specific test", SkipAll); @@ -1333,8 +1333,9 @@ void tst_QTextScriptEngine::thaiLineSplitting() void tst_QTextScriptEngine::thaiSaraAM() { - //U+0E33 (SARA AM, ำ) gets counted as two characters, so make sure it does not throw off the word boundaries - QString s(QString::fromUtf8("ฟงคำตดสนคด")); + //U+0E33 (SARA AM, ำ) gets counted as two characters, so make sure it does not throw off the word boundaries by throwing off the logClusters + QString s(QString::fromUtf8("มาฟังคำตัดสินคดีฆ่ากำนันยูร")); + unsigned short clusterNumber[] = {0,1,2,2,3,4,6,7,7,9,10,10,12,13,14,14,16,16,18,19,21,22,22,24,25,25,27}; QTextLayout layout(s); layout.beginLayout(); layout.createLine(); @@ -1344,8 +1345,15 @@ void tst_QTextScriptEngine::thaiSaraAM() e->width(0, s.length()); //force itemize and shape QCOMPARE(e->layoutData->items.size(), 1); - QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(11)); //Note that it's 11, not 10, because the SARA AM counts as two + QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(28)); + QCOMPARE(sizeof(clusterNumber) / sizeof(unsigned short), (size_t)s.size()); + for (int i = 0 ; i < e->layoutData->items[0].num_glyphs; i++) + QCOMPARE((bool)e->layoutData->glyphLayout.attributes[i].dontPrint, 0); + + for (int i = 0; i < s.length(); i++) + QCOMPARE(e->layoutData->logClustersPtr[i], clusterNumber[i]); } + QTEST_MAIN(tst_QTextScriptEngine) #include "tst_qtextscriptengine.moc" |