Calculate correct bounding rect for glyph runs in QTextLayout

The positions returned by getGlyphPositions() in QFontEngine are
for the base line of the glyphs. We offset this by -ascent to get
the top of the actual bounding rect.

Task-number: QTBUG-22919
Change-Id: Id82c66ecfbdf58064f5ad26f4193fa55ac26bc7c
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2012-04-02 15:07:55 +02:00 committed by Qt by Nokia
parent 967e9d6e28
commit d354f7d514

View File

@ -2170,7 +2170,8 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g
glyphRun.setFlags(flags);
glyphRun.setRawFont(font);
glyphRun.setBoundingRect(QRectF(selectionX.toReal(), minY, selectionWidth.toReal(), height));
glyphRun.setBoundingRect(QRectF(selectionX.toReal(), minY - font.ascent(),
selectionWidth.toReal(), height));
return glyphRun;
}