diff options
-rw-r--r-- | src/gui/text/qfontdatabase_s60.cpp | 8 | ||||
-rw-r--r-- | tests/auto/qfontmetrics/tst_qfontmetrics.cpp | 18 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index ec252cd..5e168c6 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -453,7 +453,7 @@ QFontDef cleanedFontDef(const QFontDef &req) return result; } -QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *, const QFontDef &req) +QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *d, const QFontDef &req) { const QFontCache::Key key(cleanedFontDef(req), script); @@ -498,8 +498,14 @@ QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *, const QFo static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras); const QSymbianTypeFaceExtras *typeFaceExtras = dbExtras->extras(fontFamily, request.weight > QFont::Normal, request.style != QFont::StyleNormal); + + // We need a valid pixelSize, e.g. for lineThickness() + if (request.pixelSize < 0) + request.pixelSize = request.pointSize * d->dpi / 72; + fe = new QFontEngineS60(request, typeFaceExtras); #else // QT_NO_FREETYPE + Q_UNUSED(d) QFontEngine::FaceId faceId; const QtFontFamily * const reqQtFontFamily = db->family(fontFamily); faceId.filename = reqQtFontFamily->fontFilename; diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp index a22d624..41121a5 100644 --- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp +++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp @@ -74,6 +74,7 @@ private slots: void bypassShaping(); void elidedMultiLength(); void elidedMultiLengthF(); + void lineWidth(); }; tst_QFontMetrics::tst_QFontMetrics() @@ -266,5 +267,22 @@ void tst_QFontMetrics::elidedMultiLengthF() elidedMultiLength_helper<QFontMetricsF>(); } +void tst_QFontMetrics::lineWidth() +{ + // QTBUG-13009, QTBUG-13011 + QFont smallFont; + smallFont.setPointSize(8); + smallFont.setWeight(QFont::Light); + const QFontMetrics smallFontMetrics(smallFont); + + QFont bigFont; + bigFont.setPointSize(40); + bigFont.setWeight(QFont::Black); + const QFontMetrics bigFontMetrics(bigFont); + + QVERIFY(smallFontMetrics.lineWidth() >= 1); + QVERIFY(smallFontMetrics.lineWidth() < bigFontMetrics.lineWidth()); +} + QTEST_MAIN(tst_QFontMetrics) #include "tst_qfontmetrics.moc" |