diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-02-22 14:40:40 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-03-14 08:25:42 (GMT) |
commit | c0fed43b04dec8bd549043d3ea5e28908128082c (patch) | |
tree | 53b111aa672e80585c32e5874646a2c93b186a76 /tests/auto/qtextscriptengine | |
parent | 6f5553b95c4df489e0bf047399a90e9a564314e6 (diff) | |
download | Qt-c0fed43b04dec8bd549043d3ea5e28908128082c.zip Qt-c0fed43b04dec8bd549043d3ea5e28908128082c.tar.gz Qt-c0fed43b04dec8bd549043d3ea5e28908128082c.tar.bz2 |
Introduce QFontEngineDirectWrite
Make a font engine for subpixel positioned text on Windows Vista
(with platform update) and Windows 7. If selected during
configuration, the engine will be selected only when the hinting
preference of a font is set to None or Vertical hinting. The font
database uses most of the same logic but creates a direct write
font based on the LOGFONT rather than a GDI handle.
The engine is currently regarded as experimental, meaning that code
using it should do substantial testing to make sure it covers their
use cases.
Task-number: QTBUG-12678
Reviewed-by: Jiang Jiang
Diffstat (limited to 'tests/auto/qtextscriptengine')
-rw-r--r-- | tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp index 4f4e706a..07da68d 100644 --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp @@ -61,6 +61,9 @@ #include <private/qtextengine_p.h> #include <qtextlayout.h> #undef private +#else +#include <private/qtextengine_p.h> +#include <qtextlayout.h> #endif #include <qfontdatabase.h> @@ -105,6 +108,9 @@ private slots: void linearB(); void controlInSyllable_qtbug14204(); void combiningMarks_qtbug15675(); + + void mirroredChars_data(); + void mirroredChars(); }; tst_QTextScriptEngine::tst_QTextScriptEngine() @@ -1156,5 +1162,59 @@ void tst_QTextScriptEngine::combiningMarks_qtbug15675() #endif } +void tst_QTextScriptEngine::mirroredChars_data() +{ + QTest::addColumn<int>("hintingPreference"); + + QTest::newRow("Default hinting") << int(QFont::PreferDefaultHinting); + QTest::newRow("No hinting") << int(QFont::PreferNoHinting); + QTest::newRow("Vertical hinting") << int(QFont::PreferVerticalHinting); + QTest::newRow("Full hinting") << int(QFont::PreferFullHinting); +} + +void tst_QTextScriptEngine::mirroredChars() +{ + QFETCH(int, hintingPreference); + + QFont font; + font.setHintingPreference(QFont::HintingPreference(hintingPreference)); + + QString s; + s.append(QLatin1Char('(')); + s.append(QLatin1Char(')')); + + HB_Glyph leftParenthesis; + HB_Glyph rightParenthesis; + { + QTextLayout layout(s); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + + QTextEngine *e = layout.engine(); + e->itemize(); + e->shape(0); + QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(2)); + + const QGlyphLayout &glyphLayout = e->layoutData->glyphLayout; + leftParenthesis = glyphLayout.glyphs[0]; + rightParenthesis = glyphLayout.glyphs[1]; + } + + { + QTextLayout layout(s); + layout.setFlags(Qt::TextForceRightToLeft); + + QTextEngine *e = layout.engine(); + e->itemize(); + e->shape(0); + QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(2)); + + const QGlyphLayout &glyphLayout = e->layoutData->glyphLayout; + QCOMPARE(glyphLayout.glyphs[0], rightParenthesis); + QCOMPARE(glyphLayout.glyphs[1], leftParenthesis); + } +} + QTEST_MAIN(tst_QTextScriptEngine) #include "tst_qtextscriptengine.moc" |