mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2024-11-24 03:35:54 +01:00
Decrease the italic fonts boundingbox adjustment
This commit is contained in:
parent
1aef1fcefe
commit
8e9df6cc0e
@ -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
|
// Italic fonts overflow the computed bounding rect, so reduce it
|
||||||
// a little bit.
|
// a little bit.
|
||||||
if (font.italic())
|
if (font.italic())
|
||||||
limit -= font.pixelSize();
|
limit -= font.pixelSize() / 2.0;
|
||||||
|
|
||||||
QRect br = fm.boundingRect(QRect(0, 0, limit, 0), FLAGS, text);
|
QRect br = fm.boundingRect(QRect(0, 0, limit, 0), FLAGS, text);
|
||||||
Q_ASSERT(br.isValid());
|
Q_ASSERT(br.isValid());
|
||||||
// Expand the bounding rect back to the real content size
|
// Expand the bounding rect back to the real content size
|
||||||
if (font.italic())
|
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());
|
setPos((pos - QPointF(br.width() / 2.0, br.height() / 2.0)).toPoint());
|
||||||
_boundingRect = QRectF(0, 0, br.width(), br.height());
|
_boundingRect = QRectF(0, 0, br.width(), br.height());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user