diff options
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsfontengine.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsfontengine.cpp | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 38856a69de..6b13d93259 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -1182,19 +1182,13 @@ QImage QWindowsFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &xfo return QImage(); } - QImage indexed(mask->width(), mask->height(), QImage::Format_Indexed8); + QImage alphaMap(mask->width(), mask->height(), QImage::Format_Alpha8); - // ### This part is kinda pointless, but we'll crash later if we don't because some - // code paths expects there to be colortables for index8-bit... - QVector<QRgb> colors(256); - for (int i=0; i<256; ++i) - colors[i] = qRgba(0, 0, 0, i); - indexed.setColorTable(colors); // Copy data... Cannot use QPainter here as GDI has messed up the // Alpha channel of the ni.image pixels... for (int y=0; y<mask->height(); ++y) { - uchar *dest = indexed.scanLine(y); + uchar *dest = alphaMap.scanLine(y); if (mask->image().format() == QImage::Format_RGB16) { const qint16 *src = (qint16 *) ((const QImage &) mask->image()).scanLine(y); for (int x=0; x<mask->width(); ++x) @@ -1216,7 +1210,7 @@ QImage QWindowsFontEngine::alphaMapForGlyph(glyph_t glyph, const QTransform &xfo DeleteObject(font); } - return indexed; + return alphaMap; } #define SPI_GETFONTSMOOTHINGCONTRAST 0x200C @@ -1309,17 +1303,13 @@ void QWindowsFontEngine::initFontInfo(const QFontDef &request, Will probably be superseded by a common Free Type font engine in Qt 5.X. */ QWindowsMultiFontEngine::QWindowsMultiFontEngine(QFontEngine *fe, int script) - : QFontEngineMultiBasicImpl(fe, script) + : QFontEngineMulti(fe, script) { } -void QWindowsMultiFontEngine::loadEngine(int at) +QFontEngine *QWindowsMultiFontEngine::loadEngine(int at) { - ensureFallbackFamiliesQueried(); - Q_ASSERT(at < engines.size()); - Q_ASSERT(engines.at(at) == 0); - - QFontEngine *fontEngine = engines.at(0); + QFontEngine *fontEngine = engine(0); QSharedPointer<QWindowsFontEngineData> data; LOGFONT lf; @@ -1352,23 +1342,18 @@ void QWindowsMultiFontEngine::loadEngine(int at) if (FAILED(hr)) { qErrnoWarning("%s: CreateFontFromLOGFONT failed", __FUNCTION__); } else { + Q_ASSERT(directWriteFont); IDWriteFontFace *directWriteFontFace = NULL; HRESULT hr = directWriteFont->CreateFontFace(&directWriteFontFace); if (SUCCEEDED(hr)) { + Q_ASSERT(directWriteFontFace); QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace, fontEngine->fontDef.pixelSize, data); - fedw->fontDef = fontDef; - fedw->fontDef.family = fam; - fedw->ref.ref(); - engines[at] = fedw; - - qCDebug(lcQpaFonts) << __FUNCTION__ << at << fam; - return; + return fedw; } else { qErrnoWarning("%s: CreateFontFace failed", __FUNCTION__); } - } } #endif @@ -1382,13 +1367,8 @@ void QWindowsMultiFontEngine::loadEngine(int at) hfont = (HFONT)GetStockObject(ANSI_VAR_FONT); stockFont = true; } - engines[at] = new QWindowsFontEngine(fam, hfont, stockFont, lf, data); - engines[at]->ref.ref(); - engines[at]->fontDef = fontDef; - engines[at]->fontDef.family = fam; - qCDebug(lcQpaFonts) << __FUNCTION__ << at << fam; - // TODO: increase cost in QFontCache for the font engine loaded here + return new QWindowsFontEngine(fam, hfont, stockFont, lf, data); } bool QWindowsFontEngine::supportsTransformation(const QTransform &transform) const |