diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2012-04-02 15:07:55 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-02 16:56:48 +0200 |
commit | d354f7d51444fffd1c3314d2df3622fd1f77113d (patch) | |
tree | 9c6ef7aed34f7dc4e8fef21c067fabda4bbfd6a4 | |
parent | 967e9d6e285fbdffe52d026f1c81da071f50d68c (diff) |
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>
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
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; } |