TechDraw: Fix font size issues when exporting to SVG

This commit is contained in:
Tomas Pavlicek
2019-05-27 22:18:47 +02:00
committed by WandererFan
parent 5a4373a3c4
commit fad4db3300
15 changed files with 68 additions and 79 deletions

View File

@@ -77,23 +77,5 @@ void QGCustomLabel::paint ( QPainter * painter, const QStyleOptionGraphicsItem *
QStyleOptionGraphicsItem myOption(*option);
myOption.state &= ~QStyle::State_Selected;
//see QGCustomText for explanation of this code
double dppt = 3.53;
double svgMagicX = Rez::guiX(8.0);
double svgMagicY = Rez::guiX(12.0);
double svgMagicYoffset = Rez::guiX(3.0);
double fontSize = Rez::appX(font().pointSizeF());
double ty = svgMagicY + (svgMagicYoffset*fontSize)/dppt;
QPointF svgMove(-svgMagicX/dppt,ty);
QPaintDevice* hw = painter->device();
QSvgGenerator* svg = dynamic_cast<QSvgGenerator*>(hw);
if (svg) {
painter->scale(Rez::appX(dppt),Rez::appX(dppt));
painter->translate(svgMove);
} else {
painter->scale(1.0,1.0);
}
QGraphicsTextItem::paint (painter, &myOption, widget);
}