From d354f7d51444fffd1c3314d2df3622fd1f77113d Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 2 Apr 2012 15:07:55 +0200 Subject: 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 --- src/gui/text/qtextlayout.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index d7f8130c0f..dddb802c27 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -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; } -- cgit v1.2.3