summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-04-10 13:50:01 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-14 06:43:54 +0200
commitef77c16cb00ef3788e58da8b35cb91eaf2eaa591 (patch)
treeaacc34cdd3aa8706e857e03d87f782070f8a3c41
parent3a4bd21db55a6c08ad0a8e09be0699085c7c4b59 (diff)
Make HarfBuzz-NG the default shaper on Mac
For AAT shaping support, we need either the pre-QPA shaping trick or the new HarfBuzz on Mac; prefer the latter. Disable some test cases aimed to test the HB-old behavior; enable ones that should guarantee shaping-unaware behavior. [ChangeLog][OS X] Use CoreText text shaping engine for support of complex scripts. If required, the shaping engine used in previous versions can be preferred by configuring Qt with -no-harfbuzz. Alternatively, the QT_HARFBUZZ environment variable could be set to "old". Task-number: QTBUG-18980 (relates) Task-number: QTBUG-38246 Change-Id: Iee6fe4f5bc047e77259182b8585385c5febd02b3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
-rwxr-xr-xconfigure4
-rw-r--r--src/gui/text/qtextengine.cpp2
-rw-r--r--tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp44
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp16
4 files changed, 33 insertions, 33 deletions
diff --git a/configure b/configure
index 89c2318d82..a1b006b4ea 100755
--- a/configure
+++ b/configure
@@ -616,7 +616,7 @@ CFG_EGL=auto
CFG_EGL_X=auto
CFG_FONTCONFIG=auto
CFG_FREETYPE=auto
-CFG_HARFBUZZ=no
+CFG_HARFBUZZ=auto
CFG_SQL_AVAILABLE=
QT_ALL_BUILD_PARTS=" libs tools examples tests "
QT_DEFAULT_BUILD_PARTS="libs tools examples"
@@ -5233,8 +5233,8 @@ if [ "$CFG_FREETYPE" = "auto" ]; then
fi
# harfbuzz support
-[ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_HARFBUZZ" = "auto" ] && CFG_HARFBUZZ=no
[ "$XPLATFORM_MAC" = "yes" ] && [ "$CFG_HARFBUZZ" = "auto" ] && CFG_HARFBUZZ=yes
+[ "$CFG_HARFBUZZ" = "auto" ] && CFG_HARFBUZZ=no # disable auto-detection on non-Mac for now
if [ "$CFG_HARFBUZZ" = "auto" ]; then
if compileTest unix/harfbuzz "HarfBuzz"; then
CFG_HARFBUZZ=system
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 35950c709b..967ba24fcf 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1556,8 +1556,10 @@ void QTextEngine::itemize() const
#ifdef QT_ENABLE_HARFBUZZ_NG
analysis = scriptAnalysis.data();
if (useHarfbuzzNG) {
+ // ### pretend HB-old behavior for now
for (int i = 0; i < length; ++i) {
switch (analysis[i].script) {
+ case QChar::Script_Latin:
case QChar::Script_Han:
case QChar::Script_Hiragana:
case QChar::Script_Katakana:
diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
index 56d6711dc6..d0482d77e2 100644
--- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
@@ -309,9 +309,6 @@ void tst_QTextLayout::simpleBoundingRect()
void tst_QTextLayout::threeLineBoundingRect()
{
-#if defined(Q_OS_MAC)
- QSKIP("QTestFontEngine on the mac does not support logclusters at the moment");
-#endif
/* stricter check. break text into three lines */
QString firstWord("hello");
@@ -430,9 +427,6 @@ void tst_QTextLayout::forcedBreaks()
void tst_QTextLayout::breakAny()
{
-#if defined(Q_OS_MAC)
- QSKIP("QTestFontEngine on the mac does not support logclusters at the moment");
-#endif
QString text = "ABCD";
QTextLayout layout(text, testFont);
@@ -473,9 +467,6 @@ void tst_QTextLayout::breakAny()
void tst_QTextLayout::noWrap()
{
-#if defined(Q_OS_MAC)
- QSKIP("QTestFontEngine on the mac does not support logclusters at the moment");
-#endif
QString text = "AB CD";
QTextLayout layout(text, testFont);
@@ -1048,9 +1039,6 @@ void tst_QTextLayout::charWordStopOnLineSeparator()
void tst_QTextLayout::xToCursorAtEndOfLine()
{
-#if defined(Q_OS_MAC)
- QSKIP("QTestFontEngine on the mac does not support logclusters at the moment");
-#endif
QString text = "FirstLine SecondLine";
text.replace('\n', QChar::LineSeparator);
@@ -1112,9 +1100,6 @@ void tst_QTextLayout::graphemeBoundaryForSurrogatePairs()
void tst_QTextLayout::tabStops()
{
-#if defined(Q_OS_MAC)
- QSKIP("QTestFontEngine on the mac does not support logclusters at the moment");
-#endif
QString txt("Hello there\tworld");
QTextLayout layout(txt, testFont);
layout.beginLayout();
@@ -1931,13 +1916,16 @@ void tst_QTextLayout::textWithSurrogates_qtbug15679()
void tst_QTextLayout::textWidthWithStackedTextEngine()
{
QString text = QString::fromUtf8("คลิก ถัดไป เพื่อดำเนินการต่อ");
+
QTextLayout layout(text);
layout.setCacheEnabled(true);
layout.beginLayout();
QTextLine line = layout.createLine();
layout.endLayout();
- QFontMetricsF fm(layout.font());
- QCOMPARE(line.naturalTextWidth(), fm.width(text));
+
+ QStackTextEngine layout2(text, layout.font());
+
+ QVERIFY(layout2.width(0, text.size()).toReal() >= line.naturalTextWidth());
}
void tst_QTextLayout::textWidthWithLineSeparator()
@@ -1958,27 +1946,24 @@ void tst_QTextLayout::textWidthWithLineSeparator()
void tst_QTextLayout::cursorInLigatureWithMultipleLines()
{
-#if !defined(Q_OS_MAC)
- QSKIP("This test can only be run on Mac");
-#endif
QTextLayout layout("first line finish", QFont("Times", 20));
layout.setCacheEnabled(true);
layout.beginLayout();
QTextLine line = layout.createLine();
- line.setLineWidth(70);
- line = layout.createLine();
+ line.setNumColumns(10);
+ QTextLine line2 = layout.createLine();
layout.endLayout();
- // The second line will be "finish", with "fi" as a ligature
- QEXPECT_FAIL("", "QTBUG-26403", Abort);
- QVERIFY(line.cursorToX(0) != line.cursorToX(1));
+ // The second line will be "finish"
+ QCOMPARE(layout.text().mid(line2.textStart(), line2.textLength()), QString::fromLatin1("finish"));
+
+ QVERIFY(line.cursorToX(1) != line.cursorToX(0));
+ QCOMPARE(line2.cursorToX(line2.textStart()), line.cursorToX(0));
+ QCOMPARE(line2.cursorToX(line2.textStart() + 1), line.cursorToX(1));
}
void tst_QTextLayout::xToCursorForLigatures()
{
-#if !defined(Q_OS_MAC)
- QSKIP("This test can only be run on Mac");
-#endif
QTextLayout layout("fi", QFont("Times", 20));
layout.setCacheEnabled(true);
layout.beginLayout();
@@ -2001,9 +1986,6 @@ void tst_QTextLayout::xToCursorForLigatures()
void tst_QTextLayout::cursorInNonStopChars()
{
-#if defined(Q_OS_MAC)
- QSKIP("This test can not be run on Mac");
-#endif
QTextLayout layout(QString::fromUtf8("\xE0\xA4\xA4\xE0\xA5\x8D\xE0\xA4\xA8"));
layout.setCacheEnabled(true);
layout.beginLayout();
diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
index c4db669695..5dfb025510 100644
--- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -1105,6 +1105,9 @@ void tst_QTextScriptEngine::mirroredChars()
void tst_QTextScriptEngine::controlInSyllable_qtbug14204()
{
+#ifdef Q_OS_MAC
+ QSKIP("Result differs for HarfBuzz-NG, skip test.");
+#endif
QFontDatabase db;
if (!db.families().contains(QStringLiteral("Aparajita")))
QSKIP("couldn't find 'Aparajita' font");
@@ -1143,6 +1146,10 @@ void tst_QTextScriptEngine::combiningMarks_qtbug15675_data()
QTest::addColumn<QFont>("font");
QTest::addColumn<QString>("string");
+#ifdef Q_OS_MAC
+ QSKIP("Result differs for HarfBuzz-NG, skip test.");
+#endif
+
bool hasTests = false;
QStringList families;
@@ -1274,13 +1281,22 @@ void tst_QTextScriptEngine::thaiWithZWJ()
QCOMPARE(logClusters[i], ushort(i));
for (int i = 0; i < 10; i++)
QCOMPARE(logClusters[i+7], ushort(0));
+#ifndef Q_OS_MAC
+ // ### Result differs for HarfBuzz-NG
QCOMPARE(logClusters[17], ushort(1));
+#endif
// A thai implementation could either remove the ZWJ and ZWNJ characters, or hide them.
// The current implementation hides them, so we test for that.
// The only characters that we should be hiding are the ZWJ and ZWNJ characters in position 1 and 3.
const QGlyphLayout glyphLayout = e->layoutData->glyphLayout;
for (int i = 0; i < 18; i++) {
+#ifdef Q_OS_MAC
+ // ### Result differs for HarfBuzz-NG
+ if (i == 17)
+ QCOMPARE(glyphLayout.advances[i].toInt(), 0);
+ else
+#endif
if (i == 1 || i == 3)
QCOMPARE(glyphLayout.advances[i].toInt(), 0);
else