summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-03-16 11:13:55 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-16 11:02:03 +0100
commit2ea976c3a713535c2419d936d575e0b24545f0fa (patch)
treee33f97bde687acdafda228d6132e82c78ffb7ff9 /src
parent389f2a076d3321c285fb9652177ccb3367019e51 (diff)
Fix font cache check in QFontEngineFT::recalcAdvances()
Cached font was used regardless of the format, resulting in incorrect advance in some cases when default format differed from the cached format. Task-number: QTBUG-24188 Change-Id: I39e4156bd9ba743afa7e106e934c90227fbf2b8b Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qfontengine_ft.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 8880eb7cb3..5dc757b6ce 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1564,7 +1564,9 @@ void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlag
(flags & HB_ShaperFlag_UseDesignMetrics)) && FT_IS_SCALABLE(freetype->face);
for (int i = 0; i < glyphs->numGlyphs; i++) {
Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs->glyphs[i]) : 0;
- if (g) {
+ // Since we are passing Format_None to loadGlyph, use same default format logic as loadGlyph
+ GlyphFormat acceptableFormat = (defaultFormat != Format_None) ? defaultFormat : Format_Mono;
+ if (g && g->format == acceptableFormat) {
glyphs->advances_x[i] = design ? QFixed::fromFixed(g->linearAdvance) : QFixed(g->advance);
} else {
if (!face)