[Kst] [Bug 127148] Label prints using too small a font size

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


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=127148         
arwalker sumusltd com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From arwalker sumusltd com  2006-05-24 23:45 -------
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