Version: HEAD (using KDE KDE 3.5.0) Installed from: Compiled From Sources OS: Linux PROBLEM: When printing a label the font size used is too small STEPS TO PREDOCUE: Start Kst In the default window create a label Ensure that "Auto Resize for Text" is unchecked Print the window RESULTS: The font size used for printing is much too small EXPECTED RESULTS: The text size on the printed page should roughly correspond to the text size on the screen
The problem here is that the non-"auto resize for text" label has a constant font size. This is marginally acceptable for display on the screen, but clearly collapses when exporting or printing. If we make the font size scale for printing and exporting then things would be greatly improved (though probably still a ways off from WYSIWYG). The (better) alternative would be to have the font size scale for screen display also (as they do in axes labels, legends, etc).
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);