Provide defaultFont with fontconfig db

So that it won't just return "Helvetica" that may not exist in
target system. Providing it seems to fix QTBUG-21833 as well,
thus we can remove the QEXPECT_FAIL statement in qlistview test.
'_' appears to reach the minimum right bearing in some fonts.

Task-number: QTBUG-21833
Change-Id: I2340af6ee736083ec4f6575e469840ebec4e545e
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
This commit is contained in:
Jiang Jiang 2011-11-11 17:25:30 +01:00 committed by Qt by Nokia
parent 5bc35276fb
commit 3d063ecc5f
4 changed files with 11 additions and 3 deletions

View File

@ -1218,6 +1218,7 @@ static const ushort char_table[] = {
88,
89,
91,
95,
102,
114,
124,

View File

@ -715,8 +715,10 @@ QString QFontconfigDatabase::resolveFontFamilyAlias(const QString &family) const
if (!pattern)
return family;
QByteArray cs = family.toUtf8();
FcPatternAddString(pattern, FC_FAMILY, (const FcChar8 *) cs.constData());
if (!family.isEmpty()) {
QByteArray cs = family.toUtf8();
FcPatternAddString(pattern, FC_FAMILY, (const FcChar8 *) cs.constData());
}
FcConfigSubstitute(0, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
@ -727,3 +729,8 @@ QString QFontconfigDatabase::resolveFontFamilyAlias(const QString &family) const
return resolved;
}
QFont QFontconfigDatabase::defaultFont() const
{
return QFont(resolveFontFamilyAlias(QString()));
}

View File

@ -53,6 +53,7 @@ public:
QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const;
QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName);
QString resolveFontFamilyAlias(const QString &family) const;
QFont defaultFont() const;
};
#endif // QFONTCONFIGDATABASE_H

View File

@ -1869,7 +1869,6 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems()
QApplication::processEvents();
QTest::qWait(50);
QCOMPARE(bar->value(), bar->maximum());
QEXPECT_FAIL("LeftToRight", "QTBUG-21833", Abort);
QCOMPARE(bar->maximum(), rowCount/4 - nbVisibleItem);
}