diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2010-05-25 18:19:14 (GMT) |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2010-05-31 16:23:05 (GMT) |
commit | 032fb3d54eaaa1fa36ec45b37f5f7356b1137830 (patch) | |
tree | 127dc0c3555003432aaa8add2b73385b24c74c4d /tests/auto | |
parent | 33fddc2adf95b56d8309ef9bc11408252140a085 (diff) | |
download | Qt-032fb3d54eaaa1fa36ec45b37f5f7356b1137830.zip Qt-032fb3d54eaaa1fa36ec45b37f5f7356b1137830.tar.gz Qt-032fb3d54eaaa1fa36ec45b37f5f7356b1137830.tar.bz2 |
Add the Qt::TextBypassShaping flag.
This allows quick layouting especially with Windows fonts which
contain heavy OpenType logic.
On regular latin text the visual compromize is the loss of kerning,
justification, capitalization, word spacing and letter spacing support.
Reviewed-by: Simon Hausmann
Reviewed-by: Eskil
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qfontmetrics/tst_qfontmetrics.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp index 5d73764..81e064e 100644 --- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp @@ -71,6 +71,7 @@ private slots: void elidedText(); void veryNarrowElidedText(); void averageCharWidth(); + void bypassShaping(); void elidedMultiLength(); void elidedMultiLengthF(); void bearingIncludedInBoundingRect(); @@ -219,6 +220,20 @@ void tst_QFontMetrics::averageCharWidth() QVERIFY(fmf.averageCharWidth() != 0); } +void tst_QFontMetrics::bypassShaping() +{ + QFont f; + 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<class FontMetrics> void elidedMultiLength_helper() { QString text1 = "Long Text 1\x9cShorter\x9csmall"; |