summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-11-18 02:08:21 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-11-18 02:08:21 (GMT)
commit506c4285213c8da30f16a3b94b8e8ffdcab444e2 (patch)
treeccd58fc514bf032d137b355aa5878fb59a7a49de
parent2829f215ffa2aff64bd5aa60f223653b7c38c2e9 (diff)
parented32a5262fcff59771628ed22425669f00784cb2 (diff)
downloadQt-506c4285213c8da30f16a3b94b8e8ffdcab444e2.zip
Qt-506c4285213c8da30f16a3b94b8e8ffdcab444e2.tar.gz
Qt-506c4285213c8da30f16a3b94b8e8ffdcab444e2.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fix bidi PDF mark support in Core Text shaper
-rw-r--r--src/gui/text/qfontengine_mac.mm18
-rw-r--r--tests/auto/qcomplextext/tst_qcomplextext.cpp16
2 files changed, 34 insertions, 0 deletions
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index 51e18ec..3c6f3b2 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -252,6 +252,11 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
continue;
Q_ASSERT((CTRunGetStatus(run) & kCTRunStatusRightToLeft) == rtl);
+ CFRange stringRange = CTRunGetStringRange(run);
+ UniChar endGlyph = CFStringGetCharacterAtIndex(cfstring, stringRange.location + stringRange.length - 1);
+ bool endWithPDF = QChar::direction(endGlyph) == QChar::DirPDF;
+ if (endWithPDF)
+ glyphCount++;
if (!outOBounds && outGlyphs + glyphCount - initialGlyph > *nglyphs) {
outOBounds = true;
@@ -264,6 +269,9 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttribs, NSFontAttributeName));
const uint fontIndex = (fontIndexForFont(runFont) << 24);
//NSLog(@"Run Font Name = %@", CTFontCopyFamilyName(runFont));
+ if (endWithPDF)
+ glyphCount--;
+
QVarLengthArray<CGGlyph, 512> cgglyphs(0);
const CGGlyph *tmpGlyphs = CTRunGetGlyphsPtr(run);
if (!tmpGlyphs) {
@@ -331,6 +339,16 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
(fontDef.styleStrategy & QFont::ForceIntegerMetrics)
? QFixed::fromReal(lastGlyphAdvance.width).round()
: QFixed::fromReal(lastGlyphAdvance.width);
+
+ if (endWithPDF) {
+ logClusters[stringRange.location + stringRange.length - 1] = glyphCount;
+ outGlyphs[glyphCount] = 0xFFFF;
+ outAdvances_x[glyphCount] = 0;
+ outAdvances_y[glyphCount] = 0;
+ outAttributes[glyphCount].clusterStart = true;
+ outAttributes[glyphCount].dontPrint = true;
+ glyphCount++;
+ }
}
outGlyphs += glyphCount;
outAttributes += glyphCount;
diff --git a/tests/auto/qcomplextext/tst_qcomplextext.cpp b/tests/auto/qcomplextext/tst_qcomplextext.cpp
index fa8a2d1..c66d452 100644
--- a/tests/auto/qcomplextext/tst_qcomplextext.cpp
+++ b/tests/auto/qcomplextext/tst_qcomplextext.cpp
@@ -45,6 +45,7 @@
#if !defined(Q_WS_MAC)
#include <QtTest/QtTest>
+#include <QtGui/QtGui>
#include <private/qtextengine_p.h>
#include "bidireorderstring.h"
@@ -69,6 +70,7 @@ private slots:
void bidiReorderString_data();
void bidiReorderString();
void bidiCursor_qtbug2795();
+ void bidiCursor_PDF();
};
tst_QComplexText::tst_QComplexText()
@@ -183,6 +185,20 @@ void tst_QComplexText::bidiCursor_qtbug2795()
QVERIFY(x1 == x2);
}
+void tst_QComplexText::bidiCursor_PDF()
+{
+ QString str = QString::fromUtf8("\342\200\252hello\342\200\254");
+ QTextLayout layout(str);
+
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ int size = str.size();
+
+ QVERIFY(line.cursorToX(size) == line.cursorToX(size - 1));
+}
+
QTEST_MAIN(tst_QComplexText)
#include "tst_qcomplextext.moc"