summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/fontdatabases
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-11-16 07:51:17 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-11-22 13:13:30 (GMT)
commit9d00cf202376c2b02dec27b362cf88a00e952e88 (patch)
treefdfa479fbaa5a505dd7147e379b0c58e54ebce41 /src/plugins/platforms/fontdatabases
parent687d44569dbccea72c582c6d7da9a271ae2c86c8 (diff)
downloadQt-9d00cf202376c2b02dec27b362cf88a00e952e88.zip
Qt-9d00cf202376c2b02dec27b362cf88a00e952e88.tar.gz
Qt-9d00cf202376c2b02dec27b362cf88a00e952e88.tar.bz2
Lighthouse: using QFont enums when possible in QPlatformFontdatabase
also, make it possible to register fonts in QPlatformDatabases with a null handle Reviewed-by: paul
Diffstat (limited to 'src/plugins/platforms/fontdatabases')
-rw-r--r--src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp6
-rw-r--r--src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp14
2 files changed, 13 insertions, 7 deletions
diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp
index 4634477..ee520be 100644
--- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp
+++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp
@@ -278,7 +278,7 @@ QStringList QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const
}
numFaces = face->num_faces;
- int weight = QFont::Normal;
+ QFont::Weight weight = QFont::Normal;
QFont::Style style = QFont::StyleNormal;
if (face->style_flags & FT_STYLE_FLAG_ITALIC)
@@ -315,7 +315,9 @@ QStringList QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const
fontFile->fileName = file;
fontFile->indexValue = index;
- registerFont(family,"",weight,style,100,true,true,0,writingSystems,fontFile);
+ QFont::Stretch stretch = QFont::Unstretched;
+
+ registerFont(family,"",weight,style,stretch,true,true,0,writingSystems,fontFile);
families.append(family);
diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index c9d1b74..92f30fc 100644
--- a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -395,7 +395,7 @@ void QFontconfigDatabase::populateFontDatabase()
: ((slant_value == FC_SLANT_OBLIQUE)
? QFont::StyleOblique
: QFont::StyleNormal);
- int weight = getFCWeight(weight_value);
+ QFont::Weight weight = QFont::Weight(getFCWeight(weight_value));
double pixel_size = 0;
if (!scalable) {
@@ -404,7 +404,8 @@ void QFontconfigDatabase::populateFontDatabase()
FcPatternGetDouble (fonts->fonts[i], FC_PIXEL_SIZE, 0, &pixel_size);
}
- QPlatformFontDatabase::registerFont(familyName,QLatin1String((const char *)foundry_value),weight,style,100,antialias,scalable,pixel_size,writingSystems,fontFile);
+ QFont::Stretch stretch = QFont::Unstretched;
+ QPlatformFontDatabase::registerFont(familyName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,writingSystems,fontFile);
// qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size;
}
@@ -426,10 +427,11 @@ void QFontconfigDatabase::populateFontDatabase()
QSupportedWritingSystems ws;
ws.setSupported(QFontDatabase::Latin);
+
while (f->qtname) {
- registerFont(f->qtname,"",50,QFont::StyleNormal,100,true,true,0,ws,0);
- registerFont(f->qtname,"",50,QFont::StyleItalic,100,true,true,0,ws,0);
- registerFont(f->qtname,"",50,QFont::StyleOblique,100,true,true,0,ws,0);
+ registerFont(f->qtname,QLatin1String(""),QFont::Normal,QFont::StyleNormal,QFont::Unstretched,true,true,0,ws,0);
+ registerFont(f->qtname,QLatin1String(""),QFont::Normal,QFont::StyleItalic,QFont::Unstretched,true,true,0,ws,0);
+ registerFont(f->qtname,QLatin1String(""),QFont::Normal,QFont::StyleOblique,QFont::Unstretched,true,true,0,ws,0);
++f;
}
@@ -444,6 +446,8 @@ void QFontconfigDatabase::populateFontDatabase()
QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables::Script script, void *usrPtr)
{
+ if (!usrPtr)
+ return 0;
QFontDef fontDef = f;
QFontEngineFT *engine;