[Kst] extragear/graphics/kst/src/libkstapp

Andrew Walker arwalker at sumusltd.com
Wed May 24 23:45:20 CEST 2006


SVN commit 544461 by arwalker:

BUG:127148 Scale the font size correctly when printing or exporting labels.

 M  +8 -2      kstviewlabel.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstviewlabel.cpp #544460:544461
@@ -69,7 +69,7 @@
   _justify = justify;
   _fontName = KstApp::inst()->defaultFont();
   _fontSize = 0;
-  _absFontSize = _fontSize+KstSettings::globalSettings()->plotFontSize;
+  _absFontSize = _fontSize + KstSettings::globalSettings()->plotFontSize;
   _standardActions |= Delete | Edit;
   _parsed = 0L;
   _labelMargin = 0;
@@ -95,7 +95,7 @@
   _justify = 0L;
   _fontName = KstApp::inst()->defaultFont();
   _fontSize = 0;
-  _absFontSize = _fontSize+KstSettings::globalSettings()->plotFontSize;
+  _absFontSize = _fontSize + KstSettings::globalSettings()->plotFontSize;
   _standardActions |= Delete | Edit;
   _parsed = 0L;
   reparse();
@@ -409,9 +409,13 @@
 void KstViewLabel::paintSelf(KstPainter& p, const QRegion& bounds) {
   p.save();
   if (p.type() == KstPainter::P_PRINT || p.type() == KstPainter::P_EXPORT) {
+    int absFontSizeOld = _absFontSize;
+    
     if (_autoResize) {
       adjustSizeForText(_parent->geometry());
     } else {
+      _absFontSize = int( double(absFontSizeOld) * ( double(_geom.width() + _geom.height()) / 
+                                                     double(_geomOld.width() + _geomOld.height()) ) );
       computeTextSize(_parsed);
     }
     KstBorderedViewObject::paintSelf(p, bounds);
@@ -424,6 +428,8 @@
     }
 
     drawToPainter(_parsed, p);
+    
+    _absFontSize = absFontSizeOld;
   } else {
     if (p.makingMask()) {
       p.setRasterOp(Qt::SetROP);


More information about the Kst mailing list