REG: Fix misplaced outline drawn text with native rendering

Change c238d34137 was a refactoring
which slightly changed behavior. In the case of fetching the
alpha map's bounding box, before we would call loadGlyph()
even for the case of outline drawing, as the correct bounding
rect is still needed for this case. In loadGlyphFor() however,
0 was always returned for this case, as it was only used for
populating the cache.

The simple fix for this is to add a bool to loadGlyphFor() which
adapts the original behavior when set, similar to the
fetchMetricsOnly bool in the loadGlyph() functions.

Change-Id: I76296c8aaeddbdae9e4c27ed2b30b7d59ff0843b
Task-number: QTBUG-44273
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2015-02-04 13:54:07 +01:00 committed by Jani Heikkinen
parent 8c3ae221e6
commit 434868e9d3
2 changed files with 5 additions and 4 deletions

View File

@ -1727,7 +1727,7 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matr
glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixelPosition, const QTransform &matrix, QFontEngine::GlyphFormat format)
{
Glyph *g = loadGlyphFor(glyph, subPixelPosition, format, matrix);
Glyph *g = loadGlyphFor(glyph, subPixelPosition, format, matrix, true);
glyph_metrics_t overall;
if (g) {
@ -1870,7 +1870,8 @@ void QFontEngineFT::unlockAlphaMapForGlyph()
QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g,
QFixed subPixelPosition,
GlyphFormat format,
const QTransform &t)
const QTransform &t,
bool fetchBoundingBox)
{
FT_Face face = 0;
QGlyphSet *glyphSet = 0;
@ -1883,7 +1884,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g,
Q_ASSERT(glyphSet != 0);
}
if (glyphSet != 0 && glyphSet->outline_drawing)
if (glyphSet != 0 && glyphSet->outline_drawing && !fetchBoundingBox)
return 0;
Glyph *glyph = glyphSet != 0 ? glyphSet->getGlyph(g, subPixelPosition) : 0;

View File

@ -266,7 +266,7 @@ private:
inline Glyph *loadGlyph(uint glyph, QFixed subPixelPosition, GlyphFormat format = Format_None, bool fetchMetricsOnly = false) const
{ return loadGlyph(cacheEnabled ? &defaultGlyphSet : 0, glyph, subPixelPosition, format, fetchMetricsOnly); }
Glyph *loadGlyph(QGlyphSet *set, uint glyph, QFixed subPixelPosition, GlyphFormat = Format_None, bool fetchMetricsOnly = false) const;
Glyph *loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, const QTransform &t);
Glyph *loadGlyphFor(glyph_t g, QFixed subPixelPosition, GlyphFormat format, const QTransform &t, bool fetchBoundingBox = false);
QGlyphSet *loadTransformedGlyphSet(const QTransform &matrix);