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 Change-Id: Ia934749cfda37e60ebf98fb76536434054baa4d1 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 20d869f4c54ed1b2ae472af24c66b3ed779fa207)
This commit is contained in:
parent
213777d07c
commit
9cd3e0c92c
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user