# include "qfontdatabase_s60.cpp"
#endif
QT_END_INCLUDE_NAMESPACE
-#if !defined(Q_WS_X11)
+#if !defined(Q_WS_X11) && !defined(Q_WS_QPA)
QString QFontDatabase::resolveFontFamilyAlias(const QString &family)
{
return family;
}
}
+QString QFontDatabase::resolveFontFamilyAlias(const QString &family)
+{
+ return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(family);
+}
+
QT_END_NAMESPACE
}
/*!
+ Resolve alias to actual font family names.
+
+ \since 5.0
+ */
+
+QString QPlatformFontDatabase::resolveFontFamilyAlias(const QString &family) const
+{
+ return family;
+}
+
+/*!
\class QPlatformFontDatabase
\brief The QPlatformFontDatabase class makes it possible to customize how fonts
are discovered and how they are rendered
virtual QFont defaultFont() const;
virtual QHash<QByteArray, QFont> defaultFonts() const;
+ virtual QString resolveFontFamilyAlias(const QString &family) const;
//callback
static void registerQPF2Font(const QByteArray &dataArray, void *handle);
return families;
}
+QString QFontconfigDatabase::resolveFontFamilyAlias(const QString &family) const
+{
+ FcPattern *pattern = FcPatternCreate();
+ if (!pattern)
+ return family;
+
+ QByteArray cs = family.toUtf8();
+ FcPatternAddString(pattern, FC_FAMILY, (const FcChar8 *) cs.constData());
+ FcConfigSubstitute(0, pattern, FcMatchPattern);
+ FcDefaultSubstitute(pattern);
+
+ FcChar8 *familyAfterSubstitution;
+ FcPatternGetString(pattern, FC_FAMILY, 0, &familyAfterSubstitution);
+ QString resolved = QString::fromUtf8((const char *) familyAfterSubstitution);
+ FcPatternDestroy(pattern);
+
+ return resolved;
+}
QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle);
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;
};
#endif // QFONTCONFIGDATABASE_H