Text rendering cosmetics

This commit is contained in:
Martin Tůma 2019-01-01 21:27:54 +01:00
parent a7294b30f8
commit c8e8f0013f
2 changed files with 3 additions and 2 deletions

View File

@ -26,7 +26,7 @@ int TextItem::avgCharWidth() const
ratio *= 1.1; ratio *= 1.1;
// The rest (Latin scripts, Arabic, ...) // The rest (Latin scripts, Arabic, ...)
} else { } else {
ratio = (_font.capitalization() == QFont::AllUppercase) ? 0.7 : 0.55; ratio = (_font.capitalization() == QFont::AllUppercase) ? 0.7 : 0.58;
if (_font.bold()) if (_font.bold())
ratio *= 1.1; ratio *= 1.1;
} }

View File

@ -130,7 +130,8 @@ void TextPointItem::paint(QPainter *painter) const
QRectF textRect; QRectF textRect;
if (!_icon.isNull()) { if (!_icon.isNull()) {
textRect = computeTextRect(true); textRect = (_anchor != Text::Center)
? computeTextRect(true) : _boundingRect;
#ifdef ENABLE_HIDPI #ifdef ENABLE_HIDPI
painter->drawImage(_pos - QPointF(_icon.width() painter->drawImage(_pos - QPointF(_icon.width()
/ _icon.devicePixelRatioF() / 2, _icon.height() / _icon.devicePixelRatioF() / 2, _icon.height()