From: Ivailo Monev Date: Sat, 30 Jan 2021 14:58:29 +0000 (+0200) Subject: remove unused and internal Qt::TextBypassShaping enum X-Git-Tag: 4.12.0~2649 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8bca4768f5fec589dadc946a01c0f47e4992117a;p=kde%2FKatie.git remove unused and internal Qt::TextBypassShaping enum Signed-off-by: Ivailo Monev --- diff --git a/src/core/global/qnamespace.h b/src/core/global/qnamespace.h index 9fee2bce9..a8f56e5f6 100644 --- a/src/core/global/qnamespace.h +++ b/src/core/global/qnamespace.h @@ -202,8 +202,7 @@ public: TextJustificationForced = 0x10000, TextForceLeftToRight = 0x20000, TextForceRightToLeft = 0x40000, - TextLongestVariant = 0x80000, - TextBypassShaping = 0x100000 + TextLongestVariant = 0x80000 }; enum TextElideMode { diff --git a/src/core/global/qnamespace.qdoc b/src/core/global/qnamespace.qdoc index 3a2baf3b8..bf021416f 100644 --- a/src/core/global/qnamespace.qdoc +++ b/src/core/global/qnamespace.qdoc @@ -362,7 +362,6 @@ \omitvalue TextLongestVariant Ensures that the longest variant is always used when computing the size of a multi-variant string. (Internal) - \omitvalue TextBypassShaping \omitvalue TextForceLeftToRight \omitvalue TextForceRightToLeft diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 22b49dbc4..32f0304a4 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5155,23 +5155,6 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif if (!d->engine || str.isEmpty() || pen().style() == Qt::NoPen) return; - if (tf & Qt::TextBypassShaping) { - // Skip harfbuzz complex shaping, shape using glyph advances only - int len = str.length(); - int numGlyphs = len; - QVarLengthGlyphLayoutArray glyphs(len); - QFontEngine *fontEngine = d->state->font.d->engineForScript(QUnicodeTables::Common); - if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0)) { - glyphs.resize(numGlyphs); - if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0)) - Q_ASSERT_X(false, Q_FUNC_INFO, "stringToCMap shouldn't fail twice"); - } - - QTextItemInt gf(glyphs, &d->state->font, str.data(), len, fontEngine); - drawTextItem(p, gf); - return; - } - QStackTextEngine engine(str, d->state->font); engine.option.setTextDirection(d->state->layoutDirection); if (tf & (Qt::TextForceLeftToRight|Qt::TextForceRightToLeft)) { diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index fb1e190c6..2c3a467a2 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -530,23 +530,6 @@ int QFontMetrics::width(const QString &text, int len, int flags) const if (len == 0) return 0; - if (flags & Qt::TextBypassShaping) { - // Skip harfbuzz complex shaping, only use advances - int numGlyphs = len; - QVarLengthGlyphLayoutArray glyphs(numGlyphs); - QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); - if (!engine->stringToCMap(text.data(), len, &glyphs, &numGlyphs, 0)) { - glyphs.resize(numGlyphs); - if (!engine->stringToCMap(text.data(), len, &glyphs, &numGlyphs, 0)) - Q_ASSERT_X(false, Q_FUNC_INFO, "stringToCMap shouldn't fail twice"); - } - - QFixed width; - for (int i = 0; i < numGlyphs; ++i) - width += glyphs.advances_x[i]; - return qRound(width); - } - QStackTextEngine layout(text, d.data()); layout.ignoreBidi = true; return qRound(layout.width(0, len)); diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp index 4d96562d7..643c70ddc 100644 --- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp @@ -63,7 +63,6 @@ private slots: void elidedText(); void veryNarrowElidedText(); void averageCharWidth(); - void bypassShaping(); void elidedMultiLength(); void elidedMultiLengthF(); void inFontUcs4(); @@ -213,21 +212,6 @@ void tst_QFontMetrics::averageCharWidth() QVERIFY(fmf.averageCharWidth() != 0); } -void tst_QFontMetrics::bypassShaping() -{ - QFont f; - f.setStyleStrategy(QFont::ForceIntegerMetrics); - QFontMetrics fm(f); - QString text = " A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z"; - int textWidth = fm.width(text, -1, Qt::TextBypassShaping); - QVERIFY(textWidth != 0); - int charsWidth = 0; - for (int i = 0; i < text.size(); ++i) - charsWidth += fm.width(text[i]); - // This assertion is needed in QtWebKit's WebCore::Font::offsetForPositionForSimpleText - QCOMPARE(textWidth, charsWidth); -} - template void elidedMultiLength_helper() { QString text1 = QString::fromLatin1("Long Text 1\x9cShorter\x9csmall");