diff options
Diffstat (limited to 'src/gui/text/qplatformfontdatabase.cpp')
-rw-r--r-- | src/gui/text/qplatformfontdatabase.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 48ba8987f3..0e19f6866f 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -40,6 +40,7 @@ #include "qplatformfontdatabase.h" #include <QtGui/private/qfontengine_p.h> #include <QtGui/private/qfontengine_qpf2_p.h> +#include <QtGui/private/qfontdatabase_p.h> #include <QtGui/QGuiApplication> #include <QtGui/QScreen> #include <qpa/qplatformscreen.h> @@ -376,16 +377,27 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal or using the font contained in the file referenced by \a fileName. Returns a list of family names, or an empty list if the font could not be added. + If \a applicationFont is non-null, its \c properties vector should be filled + with information from the loaded fonts. This is exposed through FontLoader in + Qt Quick where it is needed for disambiguating fonts in the same family. When + the function exits, the \a applicationFont should contain an entry of properties + per font in the file, or it should be empty if no font was loaded. + \note The default implementation of this function does not add an application font. Subclasses should reimplement this function to perform the necessary loading and registration of fonts. */ -QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName) +QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName, QFontDatabasePrivate::ApplicationFont *applicationFont) { Q_UNUSED(fontData); Q_UNUSED(fileName); + Q_UNUSED(applicationFont); + + if (applicationFont != nullptr) + applicationFont->properties.clear(); qWarning("This plugin does not support application fonts"); + return QStringList(); } @@ -534,6 +546,32 @@ enum CsbBits { }; /*! + Helper function that determines the writing system support based on the contents of the OS/2 table + in the font. + + \since 6.0 +*/ +QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromOS2Table(const char *os2Table, size_t length) +{ + if (length >= 86) { + quint32 unicodeRange[4] = { + qFromBigEndian<quint32>(os2Table + 42), + qFromBigEndian<quint32>(os2Table + 46), + qFromBigEndian<quint32>(os2Table + 50), + qFromBigEndian<quint32>(os2Table + 54) + }; + quint32 codePageRange[2] = { + qFromBigEndian<quint32>(os2Table + 78), + qFromBigEndian<quint32>(os2Table + 82) + }; + + return writingSystemsFromTrueTypeBits(unicodeRange, codePageRange); + } + + return QSupportedWritingSystems(); +} + +/*! Helper function that determines the writing systems support by a given \a unicodeRange and \a codePageRange. |