From 8e9df6cc0e5112f48dcb8d00771bc125b09d5fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sat, 10 Nov 2018 15:49:33 +0100 Subject: [PATCH] Decrease the italic fonts boundingbox adjustment --- src/textitem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/textitem.cpp b/src/textitem.cpp index abcf3fd..df18728 100644 --- a/src/textitem.cpp +++ b/src/textitem.cpp @@ -13,13 +13,13 @@ TextItem::TextItem(const QString &text, const QPointF &pos, const QFont &font, // Italic fonts overflow the computed bounding rect, so reduce it // a little bit. if (font.italic()) - limit -= font.pixelSize(); + limit -= font.pixelSize() / 2.0; QRect br = fm.boundingRect(QRect(0, 0, limit, 0), FLAGS, text); Q_ASSERT(br.isValid()); // Expand the bounding rect back to the real content size if (font.italic()) - br.adjust(-font.pixelSize() / 2, 0, font.pixelSize() / 2, 0); + br.adjust(-font.pixelSize() / 4.0, 0, font.pixelSize() / 4.0, 0); setPos((pos - QPointF(br.width() / 2.0, br.height() / 2.0)).toPoint()); _boundingRect = QRectF(0, 0, br.width(), br.height()); }