diff options
Diffstat (limited to 'src/gui/text/qrawfont.cpp')
-rw-r--r-- | src/gui/text/qrawfont.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 88b9e218fb..886cf5ef39 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); @@ -332,6 +339,23 @@ qreal QRawFont::ascent() const } /*! + Returns the cap height of this QRawFont in pixel units. + + \since 5.8 + + The cap height of a font is the height of a capital letter above + the baseline. It specifically is the height of capital letters + that are flat - such as H or I - as opposed to round letters such + as O, or pointed letters like A, both of which may display overshoot. + + \sa QFontMetricsF::capHeight() +*/ +qreal QRawFont::capHeight() const +{ + return d->isValid() ? d->fontEngine->capHeight().toReal() : 0.0; +} + +/*! Returns the descent of this QRawFont in pixel units. The descent is the distance from the base line to the lowest point |