diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-03-22 09:57:59 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-04-19 07:59:46 (GMT) |
commit | 47819dc7257c60e0feb1d02177622593ec0c2d15 (patch) | |
tree | d97eff0acbe7f7361c8d7f805b4af7313dcfcc90 /tests/auto/qglyphs | |
parent | 404568a382d09e603013734533239e18d2bf8957 (diff) | |
download | Qt-47819dc7257c60e0feb1d02177622593ec0c2d15.zip Qt-47819dc7257c60e0feb1d02177622593ec0c2d15.tar.gz Qt-47819dc7257c60e0feb1d02177622593ec0c2d15.tar.bz2 |
Long live QRawFont!
The QGlyphs API was initially attempted with a bastardization of
QFont which was meant to encapsulate a single, physical font
instance (a QFontEngine) where a set of glyph indexes would make
sense. This is not how QFont was intended to be used, and it caused
several issues. At the same time, the requirement for loading a
font from ttf/otf data and be able to access it and use it without
polluting the rest of the process with the font arose. To support
these two APIs we introduce QRawFont, which is an abstraction on
top of a single physical font.
Done-with: Jiang Jiang
Diffstat (limited to 'tests/auto/qglyphs')
-rw-r--r-- | tests/auto/qglyphs/tst_qglyphs.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/auto/qglyphs/tst_qglyphs.cpp b/tests/auto/qglyphs/tst_qglyphs.cpp index 1c0aa9e..a9ae556 100644 --- a/tests/auto/qglyphs/tst_qglyphs.cpp +++ b/tests/auto/qglyphs/tst_qglyphs.cpp @@ -46,6 +46,8 @@ #include <qtextlayout.h> #include <qfontdatabase.h> +#if !defined(QT_NO_RAWFONT) + // #define DEBUG_SAVE_IMAGE class tst_QGlyphs: public QObject @@ -116,7 +118,7 @@ static QGlyphs make_dummy_indexes() positions.append(QPointF(3, 4)); positions.append(QPointF(5, 6)); - glyphs.setFont(font); + glyphs.setFont(QRawFont::fromFont(font)); glyphs.setGlyphIndexes(glyphIndexes); glyphs.setPositions(positions); @@ -141,7 +143,7 @@ void tst_QGlyphs::copyConstructor() positions.append(QPointF(3, 4)); positions.append(QPointF(5, 6)); - glyphs.setFont(font); + glyphs.setFont(QRawFont::fromFont(font)); glyphs.setGlyphIndexes(glyphIndexes); glyphs.setPositions(positions); } @@ -180,14 +182,16 @@ void tst_QGlyphs::equalsOperator_data() positions[2] += QPointF(1, 1); busted.setPositions(positions); + QTest::newRow("Different positions") << one << busted << false; } { QGlyphs busted(two); - QFont font = busted.font(); - font.setPointSize(font.pointSize() * 2); - busted.setFont(font); + + QFont font; + font.setPixelSize(busted.font().pixelSize() * 2); + busted.setFont(QRawFont::fromFont(font)); QTest::newRow("Different fonts") << one << busted << false; } @@ -288,7 +292,7 @@ void tst_QGlyphs::drawNonExistentGlyphs() QGlyphs glyphs; glyphs.setGlyphIndexes(glyphIndexes); glyphs.setPositions(glyphPositions); - glyphs.setFont(m_testFont); + glyphs.setFont(QRawFont::fromFont(m_testFont)); QPixmap image(1000, 1000); image.fill(Qt::white); @@ -571,3 +575,4 @@ void tst_QGlyphs::drawRightToLeft() QTEST_MAIN(tst_QGlyphs) #include "tst_qglyphs.moc" +#endif // QT_NO_RAWFONT |