summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-09-20 16:38:48 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-09-22 10:29:37 +0000
commit27d2593e6d7b2474bbd14e4d5a40561ae81a448b (patch)
tree62aead8ee088b9ef80369ec5e488b18aef7274cb
parentb3aa173ec4ce13a2f6a363a7b8ba9c4c23a7feb7 (diff)
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>
-rw-r--r--src/gui/text/qrawfont.cpp13
1 files changed, 10 insertions, 3 deletions
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);