Bug 56302 - fixed font is not used when printing a message.
Summary: fixed font is not used when printing a message.
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.5.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Stephan Kulow
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-24 08:16 UTC by Ralf Reddin
Modified: 2005-02-09 00:47 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 Ralf Reddin 2003-03-24 08:16:35 UTC
Version:           1.5 (using KDE KDE 3.1)
Installed from:    SuSE RPMs
OS:          Linux

When I try to print a message that is displayed in KMail with "use fixed font", the message that is printed is not using fixed font.

Also when I double-klick the message, the fixed font is not used in the pop-up window.
Comment 1 Ingo Klöcker 2003-03-24 22:03:28 UTC
Subject: Re:  New: fixed font is not used when printing a message.

When printing a message then the font for the 'Printing Output' is used. 
Do we really need a 'fixed printing font'?

Comment 2 Ralf Reddin 2003-03-24 23:05:09 UTC
I think so. I received for example a confirmation about a flight ticket by mail and that 
was using fixed-font. For example, I received the following text: 
 
Datum   Flug    Von                  Abflug  Nach                Ankunft 
------- ------  ---------------------------  --------------------------- 
 
27MAR03 ST3780  Koeln/Bonn            10:25  Pisa/Florenz          12:05 
 
30MAR03 ST3781  Pisa/Florenz          13:50  Koeln/Bonn            15:40 
 
------- ------  ---------------------------  --------------------------- 
 
                              Flugpreis fuer 2 Passagier(e): 
                                               Flugpreis:     106.06 EUR 
                                   Flugsicherheitskosten:      23.46 EUR 
                    Drittschadenshaftpflichtversicherung:      10.44 EUR 
                                                          -------------- 
                                                  Gesamt:     139.96 EUR 
 
                                                          -------------- 
                                  Faelliger Gesamtbetrag:     139.96 EUR 
 
                                                    Visa:    -139.96 EUR 
                                                          -------------- 
                                                   Offen:       0.00 EUR 
                                                          ============== 
 
Printing this with a proportial font is not really beautyful. 
Comment 3 Andy Parkins 2004-05-24 16:34:27 UTC
The printing output font option is only active when "use custom fonts" is on.  I personally always have that off.  And therefore was expecting that when i press print, the output would look as it does on the screen (i.e. will match my current "use fixed font" option).
Comment 4 Ingo Klöcker 2005-02-09 00:14:53 UTC
CVS commit by kloecker: 

- Add a fixed width font for printing. Configurability via GUI will have to wait until after KDE 3.4.
- In the custom font case make the fixed width font used for viewing default to KDE's standard fixed width font instead of to KDE's standard non-fixed font.
- Use the new fixed width font for printing if the user enabled the Use Fixed Font option.

In the custom font case we use the fixed width font the user selected (later the fixed fonts used for viewing and printing will be configurable separately). In the non-custom font case we use KDE's standard fixed width font.
BUG:56302


  M +17 -13    csshelper.cpp   1.18


--- kdepim/kmail/csshelper.cpp  #1.17:1.18
@@ -64,5 +64,5 @@ namespace KMail {
 
     // returns CSS rules specific to the print media type
-    QString printCssDefinitions() const;
+    QString printCssDefinitions( bool fixed ) const;
 
     // returns CSS rules specific to the screen media type
@@ -73,5 +73,6 @@ namespace KMail {
 
     QFont bodyFont( bool fixed, bool print=false ) const {
-      return fixed ? mFixedFont : print ? mPrintFont : mBodyFont ;
+      return fixed ? ( print ? mFixedPrintFont : mFixedFont )
+                   : ( print ? mPrintFont : mBodyFont );
     }
     int fontSize( bool fixed, bool print=false ) const {
@@ -82,5 +83,5 @@ namespace KMail {
 
   private:
-    QFont mBodyFont, mPrintFont, mFixedFont;
+    QFont mBodyFont, mPrintFont, mFixedFont, mFixedPrintFont;
     QFont mQuoteFont[3];
     QColor mQuoteColor[3];
@@ -108,4 +109,5 @@ namespace KMail {
       mPrintFont == other.mPrintFont &&
       mFixedFont == other.mFixedFont &&
+      mFixedPrintFont == other.mFixedPrintFont &&
       mRecycleQuoteColors == other.mRecycleQuoteColors &&
       mBackingPixmapOn == other.mBackingPixmapOn &&
@@ -238,7 +240,8 @@ namespace KMail {
 
     QFont defaultFont = KGlobalSettings::generalFont();
+    QFont defaultFixedFont = KGlobalSettings::fixedFont();
     if ( fonts.readBoolEntry( "defaultFonts", true ) ) {
       mBodyFont = mPrintFont = defaultFont;
-      mFixedFont = KGlobalSettings::fixedFont();
+      mFixedFont = mFixedPrintFont = defaultFixedFont;
       defaultFont.setItalic( true );
       for ( int i = 0 ; i < 3 ; ++i )
@@ -247,5 +250,6 @@ namespace KMail {
       mBodyFont = fonts.readFontEntry(  "body-font",  &defaultFont);
       mPrintFont = fonts.readFontEntry( "print-font", &defaultFont);
-      mFixedFont = fonts.readFontEntry( "fixed-font", &defaultFont);
+      mFixedFont = fonts.readFontEntry( "fixed-font", &defaultFixedFont);
+      mFixedPrintFont = mFixedFont; // FIXME when we have a separate fixed print font
       defaultFont.setItalic( true );
       for ( int i = 0 ; i < 3 ; ++i ) {
@@ -299,5 +303,5 @@ namespace KMail {
       "@media print {\n\n"
       +
-      d->printCssDefinitions()
+      d->printCssDefinitions( fixed )
       +
       "}\n";
@@ -308,6 +312,5 @@ namespace KMail {
       "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
       "<html><head><title></title></head>\n"
-      +
-      QString( fixed ? "<body class\"fixedfont\">\n" : "<body>\n" );
+      "<body>\n";
   }
 
@@ -342,5 +345,5 @@ namespace KMail {
   }
 
-  QString CSSHelper::Private::printCssDefinitions() const {
+  QString CSSHelper::Private::printCssDefinitions( bool fixed ) const {
     const QString headerFont = QString( "  font-family: \"%1\" ! important;\n"
                                         "  font-size: %2pt ! important;\n" )
@@ -349,8 +352,9 @@ namespace KMail {
     const QColorGroup & cg = QApplication::palette().active();
 
+    const QFont printFont = bodyFont( fixed, true /* print */ );
     QString quoteCSS;
-    if ( mPrintFont.italic() )
+    if ( printFont.italic() )
       quoteCSS += "  font-style: italic ! important;\n";
-    if ( mPrintFont.bold() )
+    if ( printFont.bold() )
       quoteCSS += "  font-weight: bold ! important;\n";
     if ( !quoteCSS.isEmpty() )
@@ -364,6 +368,6 @@ namespace KMail {
                "  background-color: #ffffff ! important\n"
                "}\n\n" )
-      .arg( mPrintFont.family(),
-            QString::number( mPrintFont.pointSize() ) )
+      .arg( printFont.family(),
+            QString::number( printFont.pointSize() ) )
       +
       QString( "tr.textAtmH,\n"


Comment 5 Ingo Klöcker 2005-02-09 00:47:06 UTC
CVS commit by kloecker: 

Propagate the current value of the Use Fixed Font option to the separate message window.
CCBUG:56302


  M +4 -0      kmmainwidget.cpp   1.314
  M +10 -4     kmreadermainwin.cpp   1.42
  M +3 -0      kmreadermainwin.h   1.15


--- kdepim/kmail/kmreadermainwin.h  #1.14:1.15
@@ -28,4 +28,7 @@ public:
     const QTextCodec *codec, char *name = 0 );
   virtual ~KMReaderMainWin();
+
+  void setUseFixedFont( bool useFixedFont );
+
   // take ownership of and show @param msg
   void showMsg( const QTextCodec *codec, KMMessage *msg );

--- kdepim/kmail/kmreadermainwin.cpp  #1.41:1.42
@@ -88,4 +88,10 @@ KMReaderMainWin::~KMReaderMainWin()
 
 //-----------------------------------------------------------------------------
+void KMReaderMainWin::setUseFixedFont( bool useFixedFont )
+{
+  mReaderWin->setUseFixedFont( useFixedFont );
+}
+
+//-----------------------------------------------------------------------------
 void KMReaderMainWin::showMsg( const QTextCodec *codec, KMMessage *msg )
 {

--- kdepim/kmail/kmmainwidget.cpp  #1.313:1.314
@@ -2035,4 +2035,8 @@ void KMMainWidget::slotMsgActivated(KMMe
   assert( msg != 0 );
   KMReaderMainWin *win = new KMReaderMainWin( mFolderHtmlPref, mFolderHtmlLoadExtPref );
+  KConfigGroup reader( KMKernel::config(), "Reader" );
+  bool useFixedFont = mMsgView ? mMsgView->isFixedFont()
+                               : reader.readBoolEntry( "useFixedFont", false );
+  win->setUseFixedFont( useFixedFont );
   KMMessage *newMessage = new KMMessage(*msg);
   newMessage->setParent( msg->parent() );