<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>254029</bug_id>
          
          <creation_ts>2010-10-13 06:23:38 +0000</creation_ts>
          <short_desc>&apos;Scale Font&apos; option in OSD settings has no effect on OSD preview</short_desc>
          <delta_ts>2011-01-15 10:31:46 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>amarok</product>
          <component>Notifications</component>
          <version>2.4-GIT</version>
          <rep_platform>Ubuntu</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.4.0</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Matt Howe">mdhowe</reporter>
          <assigned_to name="Amarok Bugs">amarok-bugs-null</assigned_to>
          <cc>kfunk</cc>
    
    <cc>yeupou</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1031297</commentid>
    <comment_count>0</comment_count>
    <who name="Matt Howe">mdhowe</who>
    <bug_when>2010-10-13 06:23:38 +0000</bug_when>
    <thetext>Version:           2.4-GIT (using KDE 4.5.1) 
OS:                Linux

The Scale Font option in the OSD settings window has no effect on the OSD preview, it does however scale the font when playing tracks.

Reproducible: Always


Actual Results:  
Nothing.

Expected Results:  
Size of font in OSD preview should be larger.

OS: Linux (x86_64) release 2.6.35-22-generic
Compiler: cc</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1032510</commentid>
    <comment_count>1</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2010-10-15 13:00:31 +0000</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 195186 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1065875</commentid>
    <comment_count>2</comment_count>
    <who name="Mathieu Roy">yeupou</who>
    <bug_when>2010-12-30 22:07:02 +0000</bug_when>
    <thetext>Actually, this is not a duplicate. Bug 195186 was &quot;OSD font uses absolute point size. should be relative&quot;. Bug 195186 is fixed. But this is one is not, as of today in the current 2.4beta1. This is a distinct bug that remains to be fixed (even if it was already mentioned in bug 195186. &apos;Scale Font&apos; option in OSD settings still has no effect on OSD preview. 

You should reopen it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1067734</commentid>
    <comment_count>3</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2011-01-04 03:59:22 +0000</bug_when>
    <thetext>Reopening.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1073442</commentid>
    <comment_count>4</comment_count>
    <who name="Kevin Funk">kfunk</who>
    <bug_when>2011-01-15 10:31:46 +0000</bug_when>
    <thetext>commit ba66192ba096bce6903abde422b7c919a0bd0edc
branch master
Author: Kevin Funk &lt;krf@electrostorm.net&gt;
Date:   Sat Jan 15 02:25:15 2011 +0100

    Fix OSD preview widget wrt scaling, clean up
    
    This is a follow-up on d9d27ca96e4a1e8c06aea03c8c4cddcbbd02daf7.
    
    CCBUG: 195186
    BUG: 254029

diff --git a/ChangeLog b/ChangeLog
index c7ab729..1d9a0c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,11 +9,16 @@ VERSION 2.4.1
   CHANGES:
 
   BUGFIXES:
-    * Fixed issue with playlist tooltips that was shown independetly from &quot;Show tooltip&quot; option. (BR 263121)
-    * Fixed issues with multifiles cuesheet, when all tracks get metadata of last track
+    * Fixed &apos;Scale Font&apos; option in OSD options for OSD preview widget.
+      (BR 254029)
+    * Fixed issue with playlist tooltips that was shown independetly from
+      &quot;Show tooltip&quot; option. (BR 263121)
+    * Fixed issues with multifiles cuesheet, when all tracks get metadata of
+      last track
       in cuesheet, and each file defined in sheet gets all tracks of this sheet.
       (BR 262668) (BR 209341)
-    * Fixed crash when trying to download a full size cover and the server redirects the request. (BR 262902)
+    * Fixed crash when trying to download a full size cover and the server
+      redirects the request. (BR 262902)
     * Fixed issue when breadcrumbs stayed not updated after service insert/remove.
       (BR 262780)
     * Fixed issue with TagDialog that make metadata fields stay editable if multiple
diff --git a/src/widgets/Osd.cpp b/src/widgets/Osd.cpp
index 05c16da..b843f5d 100644
--- a/src/widgets/Osd.cpp
+++ b/src/widgets/Osd.cpp
@@ -63,7 +63,6 @@ OSDWidget::OSDWidget( QWidget *parent, const char *name )
         , m_rating( 0 )
         , m_volume( 0 )
         , m_showVolume( false )
-        , m_fontScale( 1.15 )
 {
     Qt::WindowFlags flags;
     flags = Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint;
@@ -81,6 +80,9 @@ OSDWidget::OSDWidget( QWidget *parent, const char *name )
     setFocusPolicy( Qt::NoFocus );
     unsetColors();
 
+    QFont font(&quot;sans-serif&quot;);
+    setFont(font);
+
     #ifdef Q_WS_X11
     KWindowSystem::setType( winId(), NET::Notification );
     #endif
@@ -114,10 +116,6 @@ OSDWidget::show( const QString &amp;text, QImage newImage )
     else
         m_cover = Amarok::icon();
 
-    QFont f = QFont( &quot;sans-serif&quot; );
-    f.setPointSizeF( f.pointSizeF() * m_fontScale );
-    setFont( f );
-
     m_text = text;
     show();
 }
@@ -299,8 +297,8 @@ OSDWidget::determineMetrics( const int M )
 void
 OSDWidget::paintEvent( QPaintEvent *e )
 {
-    int M = m_m;
-    QSize size = m_size;
+    const int&amp; M = m_m;
+    const QSize&amp; size = m_size;
 
     QPoint point;
     QRect rect( point, size );
@@ -381,6 +379,7 @@ OSDWidget::paintEvent( QPaintEvent *e )
 
         p.drawImage( rect.topLeft() - QPoint( 5, 5 ), ShadowEngine::makeShadow( pixmap, shadowColor ) );
     }
+    p.setFont( font() );
     p.setPen( palette().color( QPalette::Active, QPalette::WindowText ) );
     //p.setPen( Qt::white ); // This too.
     p.drawText( rect, align, m_text );
diff --git a/src/widgets/Osd.h b/src/widgets/Osd.h
index c261314..bda01df 100644
--- a/src/widgets/Osd.h
+++ b/src/widgets/Osd.h
@@ -21,17 +21,12 @@
 #include &quot;core/meta/Meta.h&quot;
 
 #include &lt;QImage&gt;
-#include &lt;QList&gt;
 #include &lt;QPixmap&gt;
 #include &lt;QString&gt;
 #include &lt;QWidget&gt; //baseclass
 
 #define OSD_WINDOW_OPACITY 0.74
 
-namespace Plasma
-{
-    class PanelSvg;
-}
 
 class OSDWidget : public QWidget
 {
@@ -77,7 +72,17 @@ class OSDWidget : public QWidget
         void setText( const QString &amp;text ) { m_text = text; }
         void setRating( const short rating ) { if ( isEnabled() ) m_rating = rating; }
         void setTranslucent( bool enabled ) { setWindowOpacity( enabled ? OSD_WINDOW_OPACITY : 1.0 ); }
-        void setFontScale( int scale ) { m_fontScale = static_cast&lt;double&gt;(scale) / 100.0; }
+        void setFontScale( int scale ) {
+            double fontScale = static_cast&lt;double&gt;( scale ) / 100.0;
+
+            // update font, reuse old one
+            QFont newFont( font() );
+            newFont.setPointSizeF( defaultPointSize() * fontScale );
+            setFont( newFont );
+        }
+
+        // work-around to get default point size on this platform, Qt API does not offer this directly
+        static inline double defaultPointSize() { return QFont().pointSizeF(); }
 
     protected:
         virtual ~OSDWidget();
@@ -109,7 +114,6 @@ class OSDWidget : public QWidget
         QImage      m_cover;
         QPixmap     m_scaledCover;
         bool        m_paused;
-        double      m_fontScale;
 };
 
 
@@ -120,9 +124,9 @@ class OSDPreviewWidget : public OSDWidget
 public:
     OSDPreviewWidget( QWidget *parent );
 
-    int screen()    { return m_screen; }
-    int alignment() { return m_alignment; }
-    int y()         { return m_y; }
+    int screen() const    { return m_screen; }
+    int alignment() const { return m_alignment; }
+    int y() const         { return m_y; }
 
 public slots:
     void setTextColor( const QColor &amp;color ) { OSDWidget::setTextColor( color ); doUpdate(); }</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>