mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-07-29 10:14:24 +02:00
Properly scale the whole tile content
This commit is contained in:
16
src/text.cpp
16
src/text.cpp
@ -157,12 +157,7 @@ void Text::addLabel(const QString &text, const QPointF &pos,
|
||||
|
||||
TextPointItem *ti;
|
||||
|
||||
if (_fontScale != 1.0) {
|
||||
QFont scaledFont(painter.font());
|
||||
scaledFont.setPixelSize(painter.font().pixelSize() * _fontScale);
|
||||
ti = new TextPointItem(text, pos, scaledFont, maxTextWidth);
|
||||
} else
|
||||
ti = new TextPointItem(text, pos, painter.font(), maxTextWidth);
|
||||
ti = new TextPointItem(text, pos, painter.font(), maxTextWidth);
|
||||
|
||||
ti->setPen(painter.pen());
|
||||
addItem(ti);
|
||||
@ -179,20 +174,17 @@ void Text::addLabel(const QString &text, const QPainterPath &path,
|
||||
if (text.isEmpty())
|
||||
return;
|
||||
|
||||
QFont scaledFont(painter.font());
|
||||
scaledFont.setPixelSize(painter.font().pixelSize() * _fontScale);
|
||||
|
||||
int textWidth = text.size() * scaledFont.pixelSize() * 0.6;
|
||||
int textWidth = text.size() * painter.font().pixelSize() * 0.6;
|
||||
if (textWidth > path.length())
|
||||
return;
|
||||
|
||||
QPainterPath tp(textPath(path, textWidth, maxAngle,
|
||||
scaledFont.pixelSize() / 2, _sceneRect));
|
||||
painter.font().pixelSize() / 2, _sceneRect));
|
||||
if (tp.isEmpty())
|
||||
return;
|
||||
|
||||
TextPathItem *pi = new TextPathItem(text, reverse(tp) ? tp.toReversed()
|
||||
: tp, scaledFont);
|
||||
: tp, painter.font());
|
||||
if (!_sceneRect.contains(pi->boundingRect())) {
|
||||
delete pi;
|
||||
return;
|
||||
|
Reference in New Issue
Block a user