Bug 87474 - Previews for Legend and Labels tab of plot dialog are strange when no font is selected
Summary: Previews for Legend and Labels tab of plot dialog are strange when no font is...
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-19 01:21 UTC by Rick Chern
Modified: 2004-08-19 02:46 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Chern 2004-08-19 01:21:20 UTC
Version:           1.0.0_devel (using KDE KDE 3.2.1)
Installed from:    Compiled From Sources
OS:                Linux

Sometimes plots contain fonts that are not available, and the font selection for the legend and/or labels tab is blank.  When this happens, the previews for these tabs show 0123456789 as the previews.  This is a bit strange - perhaps they could show "No Preview Available" or maybe nothing at all instead.
Comment 1 Andrew Walker 2004-08-19 02:46:31 UTC
CVS commit by arwalker: 

The "helvetica" is not present by default on RedHat 9 systems. We now define a Kst default font, which (if present) is helvetica.

CCMAIL: 87474-done@bugs.kde.org


  M +9 -0      kst.cpp   1.215
  M +3 -1      kst.h   1.101
  M +4 -4      kstlabel.cpp   1.43
  M +7 -2      kstlegend.cpp   1.15


--- kdeextragear-2/kst/kst/kst.cpp  #1.214:1.215
@@ -171,4 +171,8 @@ KstApp::KstApp(QWidget *parent, const ch
 
   checkFontPresent("Symbol");
+  checkFontPresent("Helvetica");
+
+  QFontInfo info(QFont("Helvetica"));
+  _defaultFont = info.family();
 
   if (!isFakingSDIApplication()) {
@@ -201,4 +205,9 @@ void KstApp::addNewWindowMenu() {
 
 
+const QString& KstApp::defaultFont( ) {
+  return _defaultFont;
+}
+
+
 void KstApp::checkFontPresent(const QString& font) {
   QFont f(font);

--- kdeextragear-2/kst/kst/kst.h  #1.100:1.101
@@ -75,4 +75,5 @@ class KstApp : public KMdiMainFrm {
 
     void checkFontPresent( const QString& strFont );
+    const QString& defaultFont( );
 
     /** add a file to the recent file list */
@@ -448,4 +449,5 @@ class KstApp : public KMdiMainFrm {
     Kst2DPlotMap _plotHolderWhileOpeningDocument;
     QTimer _memTimer;
+    QString _defaultFont;
 };
 

--- kdeextragear-2/kst/kst/kstlabel.cpp  #1.42:1.43
@@ -26,4 +26,5 @@
 
 // application specific includes
+#include "kst.h"
 #include "kstdatacollection.h"
 #include "kstdebug.h"
@@ -41,5 +42,5 @@ KstLabel::KstLabel() {
   _usePlotColor = true;
   _color.setRgb(0, 0, 0);
-  FontName = "helvetica";
+  FontName = KstApp::inst()->defaultFont();
   SymbolFontName = "Symbol";
   Size = 0;
@@ -64,5 +65,5 @@ KstLabel::KstLabel(const QString &in_tex
   _usePlotColor = true;
   _color.setRgb(0, 0, 0);
-  FontName = "helvetica";
+  FontName = KstApp::inst()->defaultFont();
   SymbolFontName = "Symbol";
   Size = 0;
@@ -648,6 +649,5 @@ void KstLabel::read(QDomElement &e) {
   _x = _y = 0.0;
   SymbolFontName = "Symbol";
-
-  FontName = "helvetica";
+  FontName = KstApp::inst()->defaultFont();
   Size = 0;
 

--- kdeextragear-2/kst/kst/kstlegend.cpp  #1.14:1.15
@@ -18,6 +18,11 @@
 #include <math.h>
 
+// include files for Qt
+
+// include files for KDE
 #include <kdebug.h>
 
+// application specific includes
+#include "kst.h"
 #include "kstlegend.h"
 #include "kstsettings.h"
@@ -35,5 +40,5 @@ KstLegend::KstLegend(
   v_offset = 0;
 
-  FontName = "helvetica";
+  FontName = KstApp::inst()->defaultFont();
   Size = 0;
   bFront = false;
@@ -218,5 +223,5 @@ void KstLegend::read(QDomElement &e) {
   Justify = CxBy;
   _x = _y = 0.0;
-  FontName = "helvetica";
+  FontName = KstApp::inst()->defaultFont();
   Size = 0;