Return color bitmap from QRawFont for color fonts

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ø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2016-09-20 16:38:48 +02:00
parent b3aa173ec4
commit 27d2593e6d

View File

@ -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);