Treat color (ARGB) glyphs, e.g. Emoji, as having unreliable glyph outlines

This is used by the scene graph to automatically switch over from distance
field text to native text rendering for the given glyph node, which allows
mixing regular text with Emoji in e.g. a Text item without having to set
renderType to Text.NativeRendering.

Change-Id: I5d96d1dab329a975e3442284bf4c5a82174177c9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This commit is contained in:
Tor Arne Vestbø 2015-06-23 13:21:56 +02:00
parent 2d1189d9f2
commit dc6191ccb4
2 changed files with 6 additions and 6 deletions

View File

@ -1344,13 +1344,13 @@ QByteArray QFontEngine::convertToPostscriptFontFamilyName(const QByteArray &fami
return f; return f;
} }
/** // Allow font engines (e.g. Windows) that can not reliably create
* Some font engines like the windows font engine // outline paths for distance-field rendering to switch the scene
* can not reliable create outline paths // graph over to native text rendering.
*/
bool QFontEngine::hasUnreliableGlyphOutline() const bool QFontEngine::hasUnreliableGlyphOutline() const
{ {
return false; // Color glyphs (Emoji) are generally not suited for outlining
return glyphFormat == QFontEngine::Format_ARGB;
} }
QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round) QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round)

View File

@ -671,7 +671,7 @@ void QWindowsFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qre
bool QWindowsFontEngine::hasUnreliableGlyphOutline() const bool QWindowsFontEngine::hasUnreliableGlyphOutline() const
{ {
return hasUnreliableOutline; return hasUnreliableOutline || QFontEngine::hasUnreliableGlyphOutline();
} }
qreal QWindowsFontEngine::minLeftBearing() const qreal QWindowsFontEngine::minLeftBearing() const