Add QRawFont from data support to Mac font db
Change-Id: I02f1c4b35b9ed585e72aa4bad9b75d3c098f8e62 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
This commit is contained in:
parent
f8725f2c8d
commit
c5383f2e49
@ -282,6 +282,29 @@ QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &f, QUnicodeTables
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QFontEngine *QCoreTextFontDatabase::fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference)
|
||||||
|
{
|
||||||
|
Q_UNUSED(hintingPreference);
|
||||||
|
|
||||||
|
QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(NULL,
|
||||||
|
fontData.constData(), fontData.size(), NULL);
|
||||||
|
|
||||||
|
CGFontRef cgFont = CGFontCreateWithDataProvider(dataProvider);
|
||||||
|
|
||||||
|
QFontEngine *fontEngine = NULL;
|
||||||
|
if (cgFont == NULL) {
|
||||||
|
qWarning("QRawFont::platformLoadFromData: CGFontCreateWithDataProvider failed");
|
||||||
|
} else {
|
||||||
|
QFontDef def;
|
||||||
|
def.pixelSize = pixelSize;
|
||||||
|
def.pointSize = pixelSize * 72.0 / qt_defaultDpi();
|
||||||
|
fontEngine = new QCoreTextFontEngine(cgFont, def);
|
||||||
|
CFRelease(cgFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
return fontEngine;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const
|
QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(family);
|
Q_UNUSED(family);
|
||||||
|
@ -51,6 +51,7 @@ public:
|
|||||||
~QCoreTextFontDatabase();
|
~QCoreTextFontDatabase();
|
||||||
void populateFontDatabase();
|
void populateFontDatabase();
|
||||||
QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle);
|
QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle);
|
||||||
|
QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference);
|
||||||
QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const;
|
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);
|
QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName);
|
||||||
void releaseHandle(void *handle);
|
void releaseHandle(void *handle);
|
||||||
|
Loading…
Reference in New Issue
Block a user