Draw ShowTabsAndSpaces symbols with the correct font

We would draw the tab and space symbols without setting the correct
font on the painter first.

[ChangeLog][QtGui][Text] Fixed so ShowTabsAndSpaces will use the
correct font.

Fixes: QTBUG-62540
Change-Id: I3b7d6d317473e7aab722dafe1a128c57a830f634
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
bb10
Eskil Abrahamsen Blomfeldt 2018-12-21 11:31:24 +01:00
parent f9d8762d37
commit ceddc14af1
1 changed files with 4 additions and 0 deletions

View File

@ -2598,6 +2598,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR
Qt::IntersectClip);
else
x /= 2; // Centered
p->setFont(f);
p->drawText(QPointF(iterator.x.toReal() + x,
y.toReal()), visualTab);
}
@ -2671,8 +2672,11 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR
if (c.style() != Qt::NoBrush)
p->setPen(c.color());
QChar visualSpace(si.analysis.flags == QScriptAnalysis::Space ? (ushort)0xb7 : (ushort)0xb0);
QFont oldFont = p->font();
p->setFont(eng->font(si));
p->drawText(QPointF(iterator.x.toReal(), itemBaseLine.toReal()), visualSpace);
p->setPen(pen);
p->setFont(oldFont);
}
}
eng->drawDecorations(p);