FontConfig: Correctly report Symbol writing system support

When all the Q_WS_X11 were removed, we also removed the special
case for symbol fonts in QFontDatabase for FontConfig. This
was checkSymbolFont() in Qt 4, and this patch copies the
code and adapts it to Qt 5.

Task-number: QTBUG-30044
Change-Id: I346f208052013eae9de3c33c210bf5db1d2aef87
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2013-03-21 15:03:36 +01:00 committed by The Qt Project
parent 46f3543aac
commit 244cc5da55

View File

@ -350,6 +350,26 @@ static const char *getFcFamilyForStyleHint(const QFont::StyleHint style)
return stylehint;
}
static bool isSymbolFont(FontFile *fontFile)
{
if (fontFile == 0 || fontFile->fileName.isEmpty())
return false;
QFontEngine::FaceId id;
id.filename = fontFile->fileName.toLocal8Bit();
id.index = fontFile->indexValue;
QFreetypeFace *f = QFreetypeFace::getFace(id);
if (f == 0) {
qWarning("isSymbolFont: Couldn't open face %s/%d", id.filename.data(), id.index);
return false;
}
bool hasSymbolMap = f->symbol_map;
f->release(id);
return hasSymbolMap;
}
void QFontconfigDatabase::populateFontDatabase()
{
FcFontSet *fonts;
@ -469,6 +489,9 @@ void QFontconfigDatabase::populateFontDatabase()
fontFile->fileName = QLatin1String((const char *)file_value);
fontFile->indexValue = indexValue;
if (isSymbolFont(fontFile))
writingSystems.setSupported(QFontDatabase::Other);
QFont::Style style = (slant_value == FC_SLANT_ITALIC)
? QFont::StyleItalic
: ((slant_value == FC_SLANT_OBLIQUE)