From 27d2593e6d7b2474bbd14e4d5a40561ae81a448b Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 20 Sep 2016 16:38:48 +0200 Subject: Return color bitmap from QRawFont for color fonts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the font in question is a color font, we should call the appropriate function bitmapForGlyph() and return the color bitmap from the font, rather than the alpha map in QRawFont::alphaMapForGlyph(). Change-Id: I2c3cd66db5a93ddf0cc463f4d136dd6771b9734c Reviewed-by: Tor Arne Vestbø Reviewed-by: Konstantin Ritt --- src/gui/text/qrawfont.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/gui/text/qrawfont.cpp') diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 8e6ffa5e94..4d567b26c2 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -261,9 +261,13 @@ void QRawFont::loadFromData(const QByteArray &fontData, \a glyphIndex in the underlying font, using the \a transform specified. If the QRawFont is not valid, this function will return an invalid QImage. - If \a antialiasingType is set to QRawFont::SubPixelAntialiasing, then the resulting image will be - in QImage::Format_RGB32 and the RGB values of each pixel will represent the subpixel opacities of - the pixel in the rasterization of the glyph. Otherwise, the image will be in the format of + If the font is a color font, then the resulting image will contain the rendered + glyph at the current pixel size. In this case, the \a antialiasingType will be + ignored. + + Otherwise, if \a antialiasingType is set to QRawFont::SubPixelAntialiasing, then the resulting image + will be in QImage::Format_RGB32 and the RGB values of each pixel will represent the subpixel opacities + of the pixel in the rasterization of the glyph. Otherwise, the image will be in the format of QImage::Format_Indexed8 and each pixel will contain the opacity of the pixel in the rasterization. @@ -275,6 +279,9 @@ QImage QRawFont::alphaMapForGlyph(quint32 glyphIndex, AntialiasingType antialias if (!d->isValid()) return QImage(); + if (d->fontEngine->glyphFormat == QFontEngine::Format_ARGB) + return d->fontEngine->bitmapForGlyph(glyphIndex, QFixed(), transform); + if (antialiasingType == SubPixelAntialiasing) return d->fontEngine->alphaRGBMapForGlyph(glyphIndex, QFixed(), transform); -- cgit v1.2.3