Move ForceIntegerMetrics testing out of the loop

Change-Id: I5732999dee63568eb83e5186cf5bf8c63709724e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Konstantin Ritt 2012-11-16 11:39:26 +02:00 committed by The Qt Project
parent 818c544d6b
commit cc378774b8
2 changed files with 9 additions and 4 deletions

View File

@ -1558,12 +1558,15 @@ void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlag
glyphs->advances_x[i] = design ? QFixed::fromFixed(face->glyph->linearHoriAdvance >> 10)
: QFixed::fromFixed(face->glyph->metrics.horiAdvance).round();
}
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
glyphs->advances_x[i] = glyphs->advances_x[i].round();
glyphs->advances_y[i] = 0;
}
if (face)
unlockFace();
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
for (int i = 0; i < glyphs->numGlyphs; ++i)
glyphs->advances_x[i] = glyphs->advances_x[i].round();
}
}
glyph_metrics_t QFontEngineFT::boundingBox(const QGlyphLayout &glyphs)

View File

@ -371,10 +371,12 @@ void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QFontEn
if (SUCCEEDED(hr)) {
for (int i=0; i<glyphs->numGlyphs; ++i) {
glyphs->advances_x[i] = DESIGN_TO_LOGICAL(glyphMetrics[i].advanceWidth);
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
glyphs->advances_x[i] = glyphs->advances_x[i].round();
glyphs->advances_y[i] = 0;
}
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
for (int i = 0; i < glyphs->numGlyphs; ++i)
glyphs->advances_x[i] = glyphs->advances_x[i].round();
}
} else {
qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__);
}