summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qglyphrun.cpp
diff options
context:
space:
mode:
authorVladimir Belyavsky <belyavskyv@gmail.com>2021-12-12 14:54:05 +0300
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-12-13 16:43:47 +0000
commit20d869f4c54ed1b2ae472af24c66b3ed779fa207 (patch)
treecf3b7f0185f99db340c9565d5ad745b9e7f481ef /src/gui/text/qglyphrun.cpp
parent3f6041fb82be5b60d0ac572f157b9e621efeb825 (diff)
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 <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/gui/text/qglyphrun.cpp')
-rw-r--r--src/gui/text/qglyphrun.cpp4
1 files changed, 2 insertions, 2 deletions
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;