Deprecate QFontDatabase constructor
Move private methods into the private class. Fixes: QTBUG-88114 Change-Id: I92fa52980ed5a0675eee310359d8875f614921e6 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
a50f0f045d
commit
5ea1f40350
@ -135,16 +135,16 @@ bool QFontDef::exactMatch(const QFontDef &other) const
|
||||
|
||||
QString this_family, this_foundry, other_family, other_foundry;
|
||||
for (int i = 0; i < origFamilies.size(); ++i) {
|
||||
QFontDatabase::parseFontName(origFamilies.at(i), this_foundry, this_family);
|
||||
QFontDatabase::parseFontName(otherFamilies.at(i), other_foundry, other_family);
|
||||
QFontDatabasePrivate::parseFontName(origFamilies.at(i), this_foundry, this_family);
|
||||
QFontDatabasePrivate::parseFontName(otherFamilies.at(i), other_foundry, other_family);
|
||||
if (this_family != other_family || this_foundry != other_foundry)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check family only if families is not set
|
||||
if (origFamilies.size() == 0) {
|
||||
QFontDatabase::parseFontName(family, this_foundry, this_family);
|
||||
QFontDatabase::parseFontName(other.family, other_foundry, other_family);
|
||||
QFontDatabasePrivate::parseFontName(family, this_foundry, this_family);
|
||||
QFontDatabasePrivate::parseFontName(other.family, other_foundry, other_family);
|
||||
}
|
||||
|
||||
return (styleHint == other.styleHint
|
||||
@ -282,7 +282,7 @@ QFontEngine *QFontPrivate::engineForScript(int script) const
|
||||
engineData = nullptr;
|
||||
}
|
||||
if (!engineData || !QT_FONT_ENGINE_FROM_DATA(engineData, script))
|
||||
QFontDatabase::load(this, script);
|
||||
QFontDatabasePrivate::load(this, script);
|
||||
return QT_FONT_ENGINE_FROM_DATA(engineData, script);
|
||||
}
|
||||
|
||||
|
@ -1230,7 +1230,7 @@ QString QFontDatabase::styleString(const QFontInfo &fontInfo)
|
||||
|
||||
Use the styleString() to obtain a text version of a style.
|
||||
|
||||
The QFontDatabase class also supports some static functions, for
|
||||
The QFontDatabase class provides some helper functions, for
|
||||
example, standardSizes(). You can retrieve the description of a
|
||||
writing system using writingSystemName(), and a sample of
|
||||
characters in a writing system with writingSystemSample().
|
||||
@ -1248,11 +1248,11 @@ QString QFontDatabase::styleString(const QFontInfo &fontInfo)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QFontDatabase::QFontDatabase()
|
||||
\obsolete Call the class methods as static functions instead.
|
||||
|
||||
Creates a font database object.
|
||||
*/
|
||||
QFontDatabase::QFontDatabase()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\enum QFontDatabase::WritingSystem
|
||||
@ -1313,7 +1313,7 @@ QFontDatabase::QFontDatabase()
|
||||
Initializes the font database if necessary and returns its
|
||||
pointer. Mutex lock must be held when calling this function.
|
||||
*/
|
||||
QFontDatabasePrivate *QFontDatabase::ensureFontDatabase()
|
||||
QFontDatabasePrivate *QFontDatabasePrivate::ensureFontDatabase()
|
||||
{
|
||||
QFontDatabasePrivate *d = privateDb();
|
||||
if (d->count == 0) {
|
||||
@ -1335,7 +1335,7 @@ QFontDatabasePrivate *QFontDatabase::ensureFontDatabase()
|
||||
QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems()
|
||||
{
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)();
|
||||
|
||||
@ -1379,7 +1379,7 @@ QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems(const QString
|
||||
parseFontName(family, foundryName, familyName);
|
||||
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)();
|
||||
|
||||
@ -1410,7 +1410,7 @@ QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems(const QString
|
||||
QStringList QFontDatabase::families(WritingSystem writingSystem)
|
||||
{
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)();
|
||||
|
||||
@ -1455,7 +1455,7 @@ QStringList QFontDatabase::styles(const QString &family)
|
||||
parseFontName(family, foundryName, familyName);
|
||||
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||
|
||||
@ -1500,7 +1500,7 @@ bool QFontDatabase::isFixedPitch(const QString &family,
|
||||
parseFontName(family, foundryName, familyName);
|
||||
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||
|
||||
@ -1526,7 +1526,7 @@ bool QFontDatabase::isBitmapScalable(const QString &family,
|
||||
parseFontName(family, foundryName, familyName);
|
||||
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||
|
||||
@ -1567,7 +1567,7 @@ bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &sty
|
||||
parseFontName(family, foundryName, familyName);
|
||||
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||
|
||||
@ -1633,7 +1633,7 @@ QList<int> QFontDatabase::pointSizes(const QString &family,
|
||||
parseFontName(family, foundryName, familyName);
|
||||
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||
|
||||
@ -1688,7 +1688,7 @@ QFont QFontDatabase::font(const QString &family, const QString &style,
|
||||
parseFontName(family, foundryName, familyName);
|
||||
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||
|
||||
@ -1737,7 +1737,7 @@ QList<int> QFontDatabase::smoothSizes(const QString &family,
|
||||
parseFontName(family, foundryName, familyName);
|
||||
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||
|
||||
@ -1803,7 +1803,7 @@ bool QFontDatabase::italic(const QString &family, const QString &style)
|
||||
parseFontName(family, foundryName, familyName);
|
||||
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||
|
||||
@ -1838,7 +1838,7 @@ bool QFontDatabase::bold(const QString &family,
|
||||
parseFontName(family, foundryName, familyName);
|
||||
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||
|
||||
@ -1875,7 +1875,7 @@ int QFontDatabase::weight(const QString &family,
|
||||
parseFontName(family, foundryName, familyName);
|
||||
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
QFontDatabasePrivate *d = ensureFontDatabase();
|
||||
QFontDatabasePrivate *d = QFontDatabasePrivate::ensureFontDatabase();
|
||||
|
||||
QT_PREPEND_NAMESPACE(load)(familyName);
|
||||
|
||||
@ -1903,7 +1903,7 @@ bool QFontDatabase::hasFamily(const QString &family)
|
||||
{
|
||||
QString parsedFamily, foundry;
|
||||
parseFontName(family, foundry, parsedFamily);
|
||||
const QString familyAlias = resolveFontFamilyAlias(parsedFamily);
|
||||
const QString familyAlias = QFontDatabasePrivate::resolveFontFamilyAlias(parsedFamily);
|
||||
return families().contains(familyAlias, Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
@ -2129,13 +2129,12 @@ QString QFontDatabase::writingSystemSample(WritingSystem writingSystem)
|
||||
return writing_system_sample(writingSystem).toString();
|
||||
}
|
||||
|
||||
|
||||
void QFontDatabase::parseFontName(const QString &name, QString &foundry, QString &family)
|
||||
void QFontDatabasePrivate::parseFontName(const QString &name, QString &foundry, QString &family)
|
||||
{
|
||||
QT_PREPEND_NAMESPACE(parseFontName)(name, foundry, family);
|
||||
}
|
||||
|
||||
void QFontDatabase::createDatabase()
|
||||
void QFontDatabasePrivate::createDatabase()
|
||||
{ initializeDb(); }
|
||||
|
||||
// used from qfontengine_ft.cpp
|
||||
@ -2356,7 +2355,7 @@ bool QFontDatabase::removeAllApplicationFonts()
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
|
||||
QFontEngine *QFontDatabasePrivate::findFont(const QFontDef &request, int script)
|
||||
{
|
||||
QMutexLocker locker(fontDatabaseMutex());
|
||||
|
||||
@ -2463,7 +2462,7 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
|
||||
return engine;
|
||||
}
|
||||
|
||||
void QFontDatabase::load(const QFontPrivate *d, int script)
|
||||
void QFontDatabasePrivate::load(const QFontPrivate *d, int script)
|
||||
{
|
||||
QFontDef req = d->request;
|
||||
|
||||
@ -2529,7 +2528,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
|
||||
for (; !fe && it != end; ++it) {
|
||||
req.families = QStringList(*it);
|
||||
|
||||
fe = QFontDatabase::findFont(req, script);
|
||||
fe = QFontDatabasePrivate::findFont(req, script);
|
||||
if (fe) {
|
||||
if (fe->type() == QFontEngine::Box && !req.families.at(0).isEmpty()) {
|
||||
if (fe->ref.loadRelaxed() == 0)
|
||||
@ -2559,7 +2558,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
|
||||
}
|
||||
}
|
||||
|
||||
QString QFontDatabase::resolveFontFamilyAlias(const QString &family)
|
||||
QString QFontDatabasePrivate::resolveFontFamilyAlias(const QString &family)
|
||||
{
|
||||
return QGuiApplicationPrivate::platformIntegration()->fontDatabase()->resolveFontFamilyAlias(family);
|
||||
}
|
||||
|
@ -51,8 +51,6 @@ QT_BEGIN_NAMESPACE
|
||||
struct QFontDef;
|
||||
class QFontEngine;
|
||||
|
||||
class QFontDatabasePrivate;
|
||||
|
||||
class Q_GUI_EXPORT QFontDatabase
|
||||
{
|
||||
Q_GADGET
|
||||
@ -111,7 +109,11 @@ public:
|
||||
|
||||
static QList<int> standardSizes();
|
||||
|
||||
QFontDatabase();
|
||||
#if QT_DEPRECATED_SINCE(6, 0)
|
||||
QT_DEPRECATED_VERSION_X_6_0("Call the static functions instead") explicit QFontDatabase() = default;
|
||||
#else
|
||||
QFontDatabase() = delete;
|
||||
#endif
|
||||
|
||||
static QList<WritingSystem> writingSystems();
|
||||
static QList<WritingSystem> writingSystems(const QString &family);
|
||||
@ -147,21 +149,6 @@ public:
|
||||
static bool removeAllApplicationFonts();
|
||||
|
||||
static QFont systemFont(SystemFont type);
|
||||
|
||||
private:
|
||||
static void createDatabase();
|
||||
static void parseFontName(const QString &name, QString &foundry, QString &family);
|
||||
static QString resolveFontFamilyAlias(const QString &family);
|
||||
static QFontEngine *findFont(const QFontDef &request, int script /* QChar::Script */);
|
||||
static void load(const QFontPrivate *d, int script /* QChar::Script */);
|
||||
static QFontDatabasePrivate *ensureFontDatabase();
|
||||
|
||||
friend struct QFontDef;
|
||||
friend class QFontPrivate;
|
||||
friend class QFontDialog;
|
||||
friend class QFontDialogPrivate;
|
||||
friend class QFontEngineMulti;
|
||||
friend class QRawFont;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -263,6 +263,13 @@ public:
|
||||
|
||||
static QFontDatabasePrivate *instance();
|
||||
|
||||
static void createDatabase();
|
||||
static void parseFontName(const QString &name, QString &foundry, QString &family);
|
||||
static QString resolveFontFamilyAlias(const QString &family);
|
||||
static QFontEngine *findFont(const QFontDef &request, int script /* QChar::Script */);
|
||||
static void load(const QFontPrivate *d, int script /* QChar::Script */);
|
||||
static QFontDatabasePrivate *ensureFontDatabase();
|
||||
|
||||
void invalidate();
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(QFontDatabasePrivate::ApplicationFont, Q_MOVABLE_TYPE);
|
||||
|
@ -1779,7 +1779,7 @@ QFontEngine *QFontEngineMulti::loadEngine(int at)
|
||||
// info about the actual script of the characters may have been discarded,
|
||||
// so we do not check for writing system support, but instead just load
|
||||
// the family indiscriminately.
|
||||
if (QFontEngine *engine = QFontDatabase::findFont(request, QChar::Script_Common)) {
|
||||
if (QFontEngine *engine = QFontDatabasePrivate::findFont(request, QChar::Script_Common)) {
|
||||
engine->fontDef.weight = request.weight;
|
||||
if (request.style > QFont::StyleNormal)
|
||||
engine->fontDef.style = request.style;
|
||||
|
@ -760,7 +760,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ
|
||||
QFontDef request(multiEngine->fontDef);
|
||||
request.styleStrategy |= QFont::NoFontMerging;
|
||||
|
||||
if (QFontEngine *engine = QFontDatabase::findFont(request, script)) {
|
||||
if (QFontEngine *engine = QFontDatabasePrivate::findFont(request, script)) {
|
||||
if (request.weight > QFont::Normal)
|
||||
engine->fontDef.weight = request.weight;
|
||||
if (request.style > QFont::StyleNormal)
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qevent.h>
|
||||
#include <qfontdatabase.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
@ -58,6 +57,7 @@
|
||||
#include <qlistview.h>
|
||||
#include <qstringlistmodel.h>
|
||||
#include <qvalidator.h>
|
||||
#include <private/qfontdatabase_p.h>
|
||||
#include <private/qdialog_p.h>
|
||||
#include <private/qfont_p.h>
|
||||
|
||||
@ -512,12 +512,12 @@ void QFontDialogPrivate::updateFamilies()
|
||||
QFont f;
|
||||
|
||||
// ##### do the right thing for a list of family names in the font.
|
||||
QFontDatabase::parseFontName(family, foundryName1, familyName1);
|
||||
QFontDatabasePrivate::parseFontName(family, foundryName1, familyName1);
|
||||
|
||||
QStringList::const_iterator it = familyNames.constBegin();
|
||||
int i = 0;
|
||||
for(; it != familyNames.constEnd(); ++it, ++i) {
|
||||
QFontDatabase::parseFontName(*it, foundryName2, familyName2);
|
||||
QFontDatabasePrivate::parseFontName(*it, foundryName2, familyName2);
|
||||
|
||||
//try to match...
|
||||
if (familyName1 == familyName2) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user