diff options
author | aavit <qt-info@nokia.com> | 2011-09-06 13:03:50 (GMT) |
---|---|---|
committer | aavit <qt-info@nokia.com> | 2011-09-06 13:03:50 (GMT) |
commit | e78edf97db002d5d8efcfd0c2df283f980d3a432 (patch) | |
tree | 0474c23ffb993723de04dc30f7bed1bf1f706b2f /src/gui | |
parent | 89f414f90d787fb695dca3611a72e1dbb32f47b0 (diff) | |
parent | 4cc331dc1713758d41f6ddf4b1dd2ed5acb8347f (diff) | |
download | Qt-e78edf97db002d5d8efcfd0c2df283f980d3a432.zip Qt-e78edf97db002d5d8efcfd0c2df283f980d3a432.tar.gz Qt-e78edf97db002d5d8efcfd0c2df283f980d3a432.tar.bz2 |
Merge remote-tracking branch 'qt-fire-team/master'
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qglyphrun.cpp | 33 | ||||
-rw-r--r-- | src/gui/text/qglyphrun.h | 4 | ||||
-rw-r--r-- | src/gui/text/qrawfont.cpp | 132 | ||||
-rw-r--r-- | src/gui/text/qrawfont.h | 6 | ||||
-rw-r--r-- | src/gui/text/qrawfont_p.h | 25 | ||||
-rw-r--r-- | src/gui/text/qrawfont_win.cpp | 80 |
6 files changed, 114 insertions, 166 deletions
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp index 442f7cc..7f43378 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -140,14 +140,18 @@ bool QGlyphRun::operator==(const QGlyphRun &other) const return false; } - for (int i=0; i<qMax(d->glyphIndexDataSize, d->glyphPositionDataSize); ++i) { - if (i < d->glyphIndexDataSize && d->glyphIndexData[i] != other.d->glyphIndexData[i]) - return false; - - if (i < d->glyphPositionDataSize && d->glyphPositionData[i] != other.d->glyphPositionData[i]) - return false; + if (d->glyphIndexData != other.d->glyphIndexData) { + for (int i = 0; i < d->glyphIndexDataSize; ++i) { + if (d->glyphIndexData[i] != other.d->glyphIndexData[i]) + return false; + } + } + if (d->glyphPositionData != other.d->glyphPositionData) { + for (int i = 0; i < d->glyphPositionDataSize; ++i) { + if (d->glyphPositionData[i] != other.d->glyphPositionData[i]) + return false; + } } - return (d->overline == other.d->overline && d->underline == other.d->underline @@ -156,13 +160,11 @@ bool QGlyphRun::operator==(const QGlyphRun &other) const } /*! + \fn bool QGlyphRun::operator!=(const QGlyphRun &other) const + Compares \a other to this QGlyphRun object. Returns true if any of the list of glyph indexes, the list of positions or the font are different, otherwise returns false. */ -bool QGlyphRun::operator!=(const QGlyphRun &other) const -{ - return !(*this == other); -} /*! Returns the font selected for this QGlyphRun object. @@ -294,6 +296,9 @@ bool QGlyphRun::overline() const */ void QGlyphRun::setOverline(bool overline) { + if (d->overline == overline) + return; + detach(); d->overline = overline; } @@ -316,6 +321,9 @@ bool QGlyphRun::underline() const */ void QGlyphRun::setUnderline(bool underline) { + if (d->underline == underline) + return; + detach(); d->underline = underline; } @@ -338,6 +346,9 @@ bool QGlyphRun::strikeOut() const */ void QGlyphRun::setStrikeOut(bool strikeOut) { + if (d->strikeOut == strikeOut) + return; + detach(); d->strikeOut = strikeOut; } diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h index cf407a8..bc7f4ff 100644 --- a/src/gui/text/qglyphrun.h +++ b/src/gui/text/qglyphrun.h @@ -79,8 +79,10 @@ public: void clear(); QGlyphRun &operator=(const QGlyphRun &other); + bool operator==(const QGlyphRun &other) const; - bool operator!=(const QGlyphRun &other) const; + inline bool operator!=(const QGlyphRun &other) const + { return !operator==(other); } void setOverline(bool overline); bool overline() const; diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 60a6cb3..c477a6a 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -46,7 +46,6 @@ #include "qrawfont.h" #include "qrawfont_p.h" -#include <QtCore/qthread.h> #include <QtCore/qendian.h> QT_BEGIN_NAMESPACE @@ -77,7 +76,7 @@ QT_BEGIN_NAMESPACE A QRawFont object represents a single, physical instance of a given font in a given pixel size. I.e. in the typical case it represents a set of TrueType or OpenType font tables and uses a - user specified pixel size to convert metrics into logical pixel units. In can be used in + user specified pixel size to convert metrics into logical pixel units. It can be used in combination with the QGlyphRun class to draw specific glyph indexes at specific positions, and also have accessors to some relevant data in the physical font. @@ -190,8 +189,7 @@ QRawFont &QRawFont::operator=(const QRawFont &other) */ bool QRawFont::isValid() const { - Q_ASSERT(d->thread == 0 || d->thread == QThread::currentThread()); - return d->fontEngine != 0; + return d->isValid(); } /*! @@ -225,7 +223,7 @@ void QRawFont::loadFromData(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) { - detach(); + d.detach(); d->cleanUp(); d->hintingPreference = hintingPreference; d->thread = QThread::currentThread(); @@ -247,13 +245,13 @@ void QRawFont::loadFromData(const QByteArray &fontData, QImage QRawFont::alphaMapForGlyph(quint32 glyphIndex, AntialiasingType antialiasingType, const QTransform &transform) const { - if (!isValid()) + if (!d->isValid()) return QImage(); if (antialiasingType == SubPixelAntialiasing) return d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixed(), 0, transform); - else - return d->fontEngine->alphaMapForGlyph(glyphIndex, QFixed(), transform); + + return d->fontEngine->alphaMapForGlyph(glyphIndex, QFixed(), transform); } /*! @@ -266,7 +264,7 @@ QImage QRawFont::alphaMapForGlyph(quint32 glyphIndex, AntialiasingType antialias */ QPainterPath QRawFont::pathForGlyph(quint32 glyphIndex) const { - if (!isValid()) + if (!d->isValid()) return QPainterPath(); QFixedPoint position; @@ -284,16 +282,19 @@ bool QRawFont::operator==(const QRawFont &other) const } /*! + \fn bool QRawFont::operator!=(const QRawFont &other) const + + Returns true if this QRawFont is not equal to \a other. Otherwise, returns false. +*/ + +/*! Returns the ascent of this QRawFont in pixel units. \sa QFontMetricsF::ascent() */ qreal QRawFont::ascent() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->ascent().toReal(); + return d->isValid() ? d->fontEngine->ascent().toReal() : 0.0; } /*! @@ -303,10 +304,7 @@ qreal QRawFont::ascent() const */ qreal QRawFont::descent() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->descent().toReal(); + return d->isValid() ? d->fontEngine->descent().toReal() : 0.0; } /*! @@ -316,10 +314,7 @@ qreal QRawFont::descent() const */ qreal QRawFont::xHeight() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->xHeight().toReal(); + return d->isValid() ? d->fontEngine->xHeight().toReal() : 0.0; } /*! @@ -329,10 +324,7 @@ qreal QRawFont::xHeight() const */ qreal QRawFont::leading() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->leading().toReal(); + return d->isValid() ? d->fontEngine->leading().toReal() : 0.0; } /*! @@ -342,10 +334,7 @@ qreal QRawFont::leading() const */ qreal QRawFont::averageCharWidth() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->averageCharWidth().toReal(); + return d->isValid() ? d->fontEngine->averageCharWidth().toReal() : 0.0; } /*! @@ -355,10 +344,7 @@ qreal QRawFont::averageCharWidth() const */ qreal QRawFont::maxCharWidth() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->maxCharWidth(); + return d->isValid() ? d->fontEngine->maxCharWidth() : 0.0; } /*! @@ -370,10 +356,7 @@ qreal QRawFont::maxCharWidth() const */ qreal QRawFont::pixelSize() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->fontDef.pixelSize; + return d->isValid() ? d->fontEngine->fontDef.pixelSize : 0.0; } /*! @@ -386,10 +369,7 @@ qreal QRawFont::pixelSize() const */ qreal QRawFont::unitsPerEm() const { - if (!isValid()) - return 0.0; - - return d->fontEngine->emSquareSize().toReal(); + return d->isValid() ? d->fontEngine->emSquareSize().toReal() : 0.0; } /*! @@ -397,10 +377,7 @@ qreal QRawFont::unitsPerEm() const */ QString QRawFont::familyName() const { - if (!isValid()) - return QString(); - - return d->fontEngine->fontDef.family; + return d->isValid() ? d->fontEngine->fontDef.family : QString(); } /*! @@ -410,10 +387,7 @@ QString QRawFont::familyName() const */ QString QRawFont::styleName() const { - if (!isValid()) - return QString(); - - return d->fontEngine->fontDef.styleName; + return d->isValid() ? d->fontEngine->fontDef.styleName : QString(); } /*! @@ -423,10 +397,7 @@ QString QRawFont::styleName() const */ QFont::Style QRawFont::style() const { - if (!isValid()) - return QFont::StyleNormal; - - return QFont::Style(d->fontEngine->fontDef.style); + return d->isValid() ? QFont::Style(d->fontEngine->fontDef.style) : QFont::StyleNormal; } /*! @@ -436,10 +407,7 @@ QFont::Style QRawFont::style() const */ int QRawFont::weight() const { - if (!isValid()) - return -1; - - return int(d->fontEngine->fontDef.weight); + return d->isValid() ? int(d->fontEngine->fontDef.weight) : -1; } /*! @@ -457,7 +425,7 @@ int QRawFont::weight() const */ QVector<quint32> QRawFont::glyphIndexesForString(const QString &text) const { - if (!isValid()) + if (!d->isValid()) return QVector<quint32>(); int nglyphs = text.size(); @@ -490,7 +458,7 @@ QVector<quint32> QRawFont::glyphIndexesForString(const QString &text) const */ bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *glyphIndexes, int *numGlyphs) const { - if (!isValid()) + if (!d->isValid()) return false; QGlyphLayout glyphs; @@ -507,7 +475,7 @@ bool QRawFont::glyphIndexesForChars(const QChar *chars, int numChars, quint32 *g */ QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes) const { - if (!isValid()) + if (!d->isValid()) return QVector<QPointF>(); int numGlyphs = glyphIndexes.size(); @@ -534,7 +502,7 @@ QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyph */ bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *advances, int numGlyphs) const { - if (!isValid()) + if (!d->isValid()) return false; QGlyphLayout glyphs; @@ -560,10 +528,7 @@ bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *adv */ QFont::HintingPreference QRawFont::hintingPreference() const { - if (!isValid()) - return QFont::PreferDefaultHinting; - - return d->hintingPreference; + return d->isValid() ? d->hintingPreference : QFont::PreferDefaultHinting; } /*! @@ -574,7 +539,7 @@ QFont::HintingPreference QRawFont::hintingPreference() const */ QByteArray QRawFont::fontTable(const char *tagName) const { - if (!isValid()) + if (!d->isValid()) return QByteArray(); const quint32 *tagId = reinterpret_cast<const quint32 *>(tagName); @@ -597,9 +562,9 @@ extern QList<QFontDatabase::WritingSystem> qt_determine_writing_systems_from_tru */ QList<QFontDatabase::WritingSystem> QRawFont::supportedWritingSystems() const { - if (isValid()) { + if (d->isValid()) { QByteArray os2Table = fontTable("OS/2"); - if (!os2Table.isEmpty() && os2Table.size() > 86) { + if (os2Table.size() > 86) { char *data = os2Table.data(); quint32 *bigEndianUnicodeRanges = reinterpret_cast<quint32 *>(data + 42); quint32 *bigEndianCodepageRanges = reinterpret_cast<quint32 *>(data + 78); @@ -627,10 +592,7 @@ QList<QFontDatabase::WritingSystem> QRawFont::supportedWritingSystems() const */ bool QRawFont::supportsCharacter(QChar character) const { - if (!isValid()) - return false; - - return d->fontEngine->canRender(&character, 1); + return d->isValid() && d->fontEngine->canRender(&character, 1); } /*! @@ -641,9 +603,6 @@ bool QRawFont::supportsCharacter(QChar character) const */ bool QRawFont::supportsCharacter(quint32 ucs4) const { - if (!isValid()) - return false; - QChar str[2]; int len; if (!QChar::requiresSurrogates(ucs4)) { @@ -655,7 +614,7 @@ bool QRawFont::supportsCharacter(quint32 ucs4) const len = 2; } - return d->fontEngine->canRender(str, len); + return d->isValid() && d->fontEngine->canRender(str, len); } // qfontdatabase.cpp @@ -667,6 +626,7 @@ extern int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSyst */ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writingSystem) { + QRawFont rawFont; #if defined(Q_WS_MAC) QTextLayout layout(QFontDatabase::writingSystemSample(writingSystem), font); layout.beginLayout(); @@ -677,14 +637,12 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ // Pick the one matches the family name we originally requested, // if none of them match, just pick the first one for (int i = 0; i < list.size(); i++) { - QGlyphRun glyphs = list.at(i); - QRawFont rawfont = glyphs.rawFont(); + rawfont = list.at(i).rawFont(); if (rawfont.familyName() == font.family()) return rawfont; } return list.at(0).rawFont(); } - return QRawFont(); #else QFontPrivate *font_d = QFontPrivate::get(font); int script = qt_script_for_writing_system(writingSystem); @@ -700,15 +658,12 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ } if (fe != 0) { - QRawFont rawFont; rawFont.d.data()->fontEngine = fe; rawFont.d.data()->fontEngine->ref.ref(); rawFont.d.data()->hintingPreference = font.hintingPreference(); - return rawFont; - } else { - return QRawFont(); } #endif + return rawFont; } /*! @@ -719,7 +674,7 @@ void QRawFont::setPixelSize(qreal pixelSize) if (d->fontEngine == 0) return; - detach(); + d.detach(); QFontEngine *oldFontEngine = d->fontEngine; d->fontEngine = d->fontEngine->cloneWithSize(pixelSize); @@ -734,15 +689,6 @@ void QRawFont::setPixelSize(qreal pixelSize) /*! \internal */ -void QRawFont::detach() -{ - if (d->ref != 1) - d.detach(); -} - -/*! - \internal -*/ void QRawFontPrivate::cleanUp() { platformCleanUp(); diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index d5b5680..cf77996 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -81,7 +81,10 @@ public: bool isValid() const; QRawFont &operator=(const QRawFont &other); + bool operator==(const QRawFont &other) const; + inline bool operator!=(const QRawFont &other) const + { return !operator==(other); } QString familyName() const; QString styleName() const; @@ -132,9 +135,6 @@ public: private: friend class QRawFontPrivate; - - void detach(); - QExplicitlySharedDataPointer<QRawFontPrivate> d; }; diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h index fdf7cad..3557751 100644 --- a/src/gui/text/qrawfont_p.h +++ b/src/gui/text/qrawfont_p.h @@ -54,7 +54,9 @@ // #include "qrawfont.h" + #include "qfontengine_p.h" +#include <QtCore/qthread.h> #include <QtCore/qthreadstorage.h> #if !defined(QT_NO_RAWFONT) @@ -71,21 +73,17 @@ public: , thread(0) #if defined(Q_WS_WIN) , fontHandle(NULL) - , ptrAddFontMemResourceEx(NULL) - , ptrRemoveFontMemResourceEx(NULL) #endif {} QRawFontPrivate(const QRawFontPrivate &other) - : hintingPreference(other.hintingPreference) + : fontEngine(other.fontEngine) + , hintingPreference(other.hintingPreference) , thread(other.thread) #if defined(Q_WS_WIN) , fontHandle(NULL) - , ptrAddFontMemResourceEx(other.ptrAddFontMemResourceEx) - , ptrRemoveFontMemResourceEx(other.ptrRemoveFontMemResourceEx) #endif { - fontEngine = other.fontEngine; if (fontEngine != 0) fontEngine->ref.ref(); } @@ -96,6 +94,12 @@ public: cleanUp(); } + inline bool isValid() const + { + Q_ASSERT(thread == 0 || thread == QThread::currentThread()); + return fontEngine != 0; + } + void cleanUp(); void platformCleanUp(); void platformLoadFromData(const QByteArray &fontData, @@ -111,14 +115,7 @@ public: #if defined(Q_WS_WIN) HANDLE fontHandle; - - typedef HANDLE (WINAPI *PtrAddFontMemResourceEx)(PVOID, DWORD, PVOID, DWORD *); - typedef BOOL (WINAPI *PtrRemoveFontMemResourceEx)(HANDLE); - - PtrAddFontMemResourceEx ptrAddFontMemResourceEx; - PtrRemoveFontMemResourceEx ptrRemoveFontMemResourceEx; - -#endif // Q_WS_WIN +#endif }; QT_END_NAMESPACE diff --git a/src/gui/text/qrawfont_win.cpp b/src/gui/text/qrawfont_win.cpp index 779652f..ea1e75b 100644 --- a/src/gui/text/qrawfont_win.cpp +++ b/src/gui/text/qrawfont_win.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qrawfont_p.h" + +#if !defined(QT_NO_RAWFONT) + #include <private/qsystemlibrary_p.h> #if !defined(QT_NO_DIRECTWRITE) @@ -47,8 +50,6 @@ # include <dwrite.h> #endif -#if !defined(QT_NO_RAWFONT) - QT_BEGIN_NAMESPACE namespace { @@ -61,18 +62,16 @@ namespace { operator T() const { T littleEndian = 0; - for (int i=0; i<sizeof(T); ++i) { + for (int i = 0; i < int(sizeof(T)); ++i) littleEndian |= data[i] << ((sizeof(T) - i - 1) * 8); - } return littleEndian; } BigEndian<T> &operator=(const T &t) { - for (int i=0; i<sizeof(T); ++i) { + for (int i = 0; i < int(sizeof(T)); ++i) data[i] = ((t >> (sizeof(T) - i - 1) * 8) & 0xff); - } return *this; } @@ -157,7 +156,7 @@ namespace { class EmbeddedFont { public: - EmbeddedFont(const QByteArray &fontData); + EmbeddedFont(const QByteArray &fontData) : m_fontData(fontData) {} QString changeFamilyName(const QString &newFamilyName); QByteArray data() const { return m_fontData; } @@ -168,10 +167,6 @@ namespace { QByteArray m_fontData; }; - EmbeddedFont::EmbeddedFont(const QByteArray &fontData) : m_fontData(fontData) - { - } - TableDirectory *EmbeddedFont::tableDirectoryEntry(const QByteArray &tagName) { Q_ASSERT(tagName.size() == 4); @@ -214,9 +209,9 @@ namespace { + nameRecord->offset; const BigEndian<quint16> *s = reinterpret_cast<const BigEndian<quint16> *>(ptr); - for (int j=0; j<nameRecord->length / sizeof(quint16); ++j) - name += QChar(s[j]); - + const BigEndian<quint16> *e = s + nameRecord->length / sizeof(quint16); + while (s != e) + name += QChar(*s++); break; } } @@ -525,41 +520,49 @@ extern QFontEngine *qt_load_font_engine_win(const QFontDef &request); // From qfontdatabase.cpp extern QFont::Weight weightFromInteger(int weight); -void QRawFontPrivate::platformCleanUp() +typedef HANDLE (WINAPI *PtrAddFontMemResourceEx)(PVOID, DWORD, PVOID, DWORD *); +static PtrAddFontMemResourceEx ptrAddFontMemResourceEx = 0; +typedef BOOL (WINAPI *PtrRemoveFontMemResourceEx)(HANDLE); +static PtrRemoveFontMemResourceEx ptrRemoveFontMemResourceEx = 0; + +static void resolveGdi32() { - if (fontHandle != NULL) { - if (ptrRemoveFontMemResourceEx == NULL) { - void *func = QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); - ptrRemoveFontMemResourceEx = - reinterpret_cast<QRawFontPrivate::PtrRemoveFontMemResourceEx>(func); + static bool triedResolve = false; + if (!triedResolve) { + QSystemLibrary gdi32(QLatin1String("gdi32")); + if (gdi32.load()) { + ptrAddFontMemResourceEx = (PtrAddFontMemResourceEx)gdi32.resolve("AddFontMemResourceEx"); + ptrRemoveFontMemResourceEx = (PtrRemoveFontMemResourceEx)gdi32.resolve("RemoveFontMemResourceEx"); } - if (ptrRemoveFontMemResourceEx == NULL) { - qWarning("QRawFont::platformCleanUp: Can't find RemoveFontMemResourceEx in gdi32"); - fontHandle = NULL; - } else { + triedResolve = true; + } +} + +void QRawFontPrivate::platformCleanUp() +{ + if (fontHandle != NULL) { + if (ptrRemoveFontMemResourceEx) ptrRemoveFontMemResourceEx(fontHandle); - fontHandle = NULL; - } + fontHandle = NULL; } } -void QRawFontPrivate::platformLoadFromData(const QByteArray &_fontData, +void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) { - QByteArray fontData(_fontData); EmbeddedFont font(fontData); #if !defined(QT_NO_DIRECTWRITE) if (hintingPreference == QFont::PreferDefaultHinting - || hintingPreference == QFont::PreferFullHinting) + || hintingPreference == QFont::PreferFullHinting) #endif { GUID guid; CoCreateGuid(&guid); - QString uniqueFamilyName = QString::fromLatin1("f") + QString uniqueFamilyName = QLatin1Char('f') + QString::number(guid.Data1, 36) + QLatin1Char('-') + QString::number(guid.Data2, 36) + QLatin1Char('-') + QString::number(guid.Data3, 36) + QLatin1Char('-') @@ -571,22 +574,11 @@ void QRawFontPrivate::platformLoadFromData(const QByteArray &_fontData, return; } - if (ptrAddFontMemResourceEx == NULL || ptrRemoveFontMemResourceEx == NULL) { - void *func = QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); - ptrRemoveFontMemResourceEx = - reinterpret_cast<QRawFontPrivate::PtrRemoveFontMemResourceEx>(func); - - func = QSystemLibrary::resolve(QLatin1String("gdi32"), "AddFontMemResourceEx"); - ptrAddFontMemResourceEx = - reinterpret_cast<QRawFontPrivate::PtrAddFontMemResourceEx>(func); - } - Q_ASSERT(fontHandle == NULL); - if (ptrAddFontMemResourceEx != NULL && ptrRemoveFontMemResourceEx != NULL) { + resolveGdi32(); + if (ptrAddFontMemResourceEx && ptrRemoveFontMemResourceEx) { DWORD count = 0; - fontData = font.data(); - fontHandle = ptrAddFontMemResourceEx(fontData.data(), fontData.size(), 0, &count); - + fontHandle = ptrAddFontMemResourceEx((void *)fontData.constData(), fontData.size(), 0, &count); if (count == 0 && fontHandle != NULL) { ptrRemoveFontMemResourceEx(fontHandle); fontHandle = NULL; |