From 20d869f4c54ed1b2ae472af24c66b3ed779fa207 Mon Sep 17 00:00:00 2001 From: Vladimir Belyavsky Date: Sun, 12 Dec 2021 14:54:05 +0300 Subject: QGlyphRun: always use stored bounding rect even if it's empty QGlyphRun's bounding rectangle may have zero width, e.g. when it contains only non-printable characters. Some code, e.g. QTextLine::glyphRuns(), may pre-calculate bounding rectangle for QGlyphRun and store it inside via QGlyphRun::setBoundingRect(). Previously, we would ignore empty rects as an indication that no bounding rect had been set on the QGlyphRun. This should be checking for valid rects instead, to allow for runs containing non-printable characters exclusively. Fixes: QTBUG-96463 Pick-to: 6.2 Change-Id: Ia934749cfda37e60ebf98fb76536434054baa4d1 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qglyphrun.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gui/text/qglyphrun.cpp') diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp index 8982e2e1c4..3a10fd1ccf 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -434,7 +434,7 @@ void QGlyphRun::setFlags(GlyphRunFlags flags) /*! Sets the bounding rect of the glyphs in this QGlyphRun to be \a boundingRect. This rectangle - will be returned by boundingRect() unless it is empty, in which case the bounding rectangle of the + will be returned by boundingRect() unless it is null, in which case the bounding rectangle of the glyphs in the glyph run will be returned instead. \note Unless you are implementing text shaping, you should not have to use this function. @@ -468,7 +468,7 @@ void QGlyphRun::setBoundingRect(const QRectF &boundingRect) */ QRectF QGlyphRun::boundingRect() const { - if (!d->boundingRect.isEmpty() || !d->rawFont.isValid()) + if (!d->boundingRect.isNull() || !d->rawFont.isValid()) return d->boundingRect; qreal minX, minY, maxX, maxY; -- cgit v1.2.3