From c61ccc79da84c4fb40456b21e56610dcb0f70201 Mon Sep 17 00:00:00 2001
From: "Stefan Knorr (astron)" <heinzlesspam@gmail.com>
Date: Wed, 2 May 2012 16:33:59 +0200
Subject: [PATCH 1/2] Use normal font in tab headers

---
 vcl/aqua/source/app/salinst.cxx |    1 -
 vcl/inc/svdata.hxx              |    1 -
 vcl/inc/vcl/tabctrl.hxx         |    1 -
 vcl/ios/source/app/salinst.cxx  |    1 -
 vcl/source/control/tabctrl.cxx  |   28 +++-------------------------
 5 files changed, 3 insertions(+), 29 deletions(-)

diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index 794dd84..f8a8835 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -448,7 +448,6 @@ SalInstance* CreateSalInstance()
     SalData::ensureThreadAutoreleasePool();
     // no focus rects on NWF aqua
     ImplGetSVData()->maNWFData.mbNoFocusRects = true;
-    ImplGetSVData()->maNWFData.mbNoBoldTabFocus = true;
     ImplGetSVData()->maNWFData.mbNoActiveTabTextRaise = true;
     ImplGetSVData()->maNWFData.mbCenteredTabs = true;
     ImplGetSVData()->maNWFData.mbProgressNeedsErase = true;
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index c21d580..97b47d2 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -313,7 +313,6 @@ struct ImplSVNWFData
     bool                    mbTransparentMenubar:1;         //< keep the background of the menubar transparent; needed for the Aero theme
     bool                    mbOpenMenuOnF10:1;              // on gnome the first menu opens on F10
     bool                    mbNoFocusRects:1;               // on Aqua focus rects are not used
-    bool                    mbNoBoldTabFocus:1;             // on Aqua and Gnome the focused tab has not bold text
     bool                    mbCenteredTabs:1;               // on Aqua, tabs are centered
     bool                    mbNoActiveTabTextRaise:1;       // on Aqua the text for the selected tab
                                                             // should not "jump up" a pixel
diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx
index fd064db..c9d8583 100644
--- a/vcl/inc/vcl/tabctrl.hxx
+++ b/vcl/inc/vcl/tabctrl.hxx
@@ -68,7 +68,6 @@ private:
     sal_Bool                mbRestoreHelpId;
     sal_Bool                mbRestoreUnqId;
     sal_Bool                mbSmallInvalidate;
-    sal_Bool                mbExtraSpace;
     Link                maActivateHdl;
     Link                maDeactivateHdl;
 
diff --git a/vcl/ios/source/app/salinst.cxx b/vcl/ios/source/app/salinst.cxx
index e3747c2..5536538 100644
--- a/vcl/ios/source/app/salinst.cxx
+++ b/vcl/ios/source/app/salinst.cxx
@@ -314,7 +314,6 @@ SalInstance* CreateSalInstance()
     SalData::ensureThreadAutoreleasePool();
     // no focus rects on NWF ios
     ImplGetSVData()->maNWFData.mbNoFocusRects = true;
-    ImplGetSVData()->maNWFData.mbNoBoldTabFocus = true;
     ImplGetSVData()->maNWFData.mbNoActiveTabTextRaise = true;
     ImplGetSVData()->maNWFData.mbCenteredTabs = true;
     ImplGetSVData()->maNWFData.mbProgressNeedsErase = true;
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index fb73946..292e091 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -121,7 +121,6 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle )
     mbRestoreHelpId             = sal_False;
     mbRestoreUnqId              = sal_False;
     mbSmallInvalidate           = sal_False;
-    mbExtraSpace                = sal_False;
     mpTabCtrlData               = new ImplTabCtrlData;
     mpTabCtrlData->mpListBox    = NULL;
 
@@ -326,12 +325,9 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth )
         return aContentRgn.GetSize();
     }
 
-    // For systems without synthetic bold support
-    if ( mbExtraSpace )
-        aSize.Width() += TAB_EXTRASPACE_X;
     // For languages with short names (e.g. Chinese), because the space is
     // normally only one pixel per char
-    else if ( pItem->maFormatText.Len() < TAB_EXTRASPACE_X )
+    if ( pItem->maFormatText.Len() < TAB_EXTRASPACE_X )
         aSize.Width() += TAB_EXTRASPACE_X-pItem->maFormatText.Len();
 
     // Evt. den Text kuerzen
@@ -407,22 +403,8 @@ Rectangle TabControl::ImplGetTabRect( sal_uInt16 nItemPos, long nWidth, long nHe
     if ( mbFormat || (mnLastWidth != nWidth) || (mnLastHeight != nHeight) )
     {
         Font aFont( GetFont() );
-        Font aLightFont = aFont;
         aFont.SetTransparent( sal_True );
-        aFont.SetWeight( (!ImplGetSVData()->maNWFData.mbNoBoldTabFocus) ? WEIGHT_BOLD : WEIGHT_LIGHT );
-        aLightFont.SetTransparent( sal_True );
-        aLightFont.SetWeight( WEIGHT_LIGHT );
-
-        // If Bold and none Bold strings have the same width, we
-        // add in the calcultion extra space, so that the tabs
-        // looks better. The could be the case on systems without
-        // an bold UI font and without synthetic bold support
-        XubString aTestStr( RTL_CONSTASCII_USTRINGPARAM( "Abc." ) );
-        SetFont( aLightFont );
-        long nTextWidth1 = GetTextWidth( aTestStr );
         SetFont( aFont );
-        long nTextWidth2 = GetTextWidth( aTestStr );
-        mbExtraSpace = (nTextWidth1 == nTextWidth2);
 
         Size            aSize;
         const long      nOffsetX = 2 + GetItemsOffset().X();
@@ -723,9 +705,7 @@ void TabControl::ImplShowFocus()
     // make sure the focussed item rect is computed using a bold font
     // the font may have changed meanwhile due to mouse over
 
-    Font aOldFont( GetFont() );
-    Font aFont( aOldFont );
-    aFont.SetWeight( (!ImplGetSVData()->maNWFData.mbNoBoldTabFocus) ? WEIGHT_BOLD : WEIGHT_LIGHT );
+    Font aFont( GetFont() );
     SetFont( aFont );
 
     sal_uInt16                   nCurPos     = GetPagePos( mnCurPageId );
@@ -771,8 +751,7 @@ void TabControl::ImplShowFocus()
         aRect.Bottom() = aRect.Top() + aImageSize.Height() + 4;
     }
     ShowFocus( aRect );
-
-    SetFont( aOldFont );
+    SetFont( aFont );
 }
 
 // -----------------------------------------------------------------------
@@ -939,7 +918,6 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo
     // we set the font attributes always before drawing to be re-entrant (DrawNativeControl may trigger additional paints)
     Font aFont( GetFont() );
     aFont.SetTransparent( sal_True );
-    aFont.SetWeight( ((bIsCurrentItem) && (!ImplGetSVData()->maNWFData.mbNoBoldTabFocus)) ? WEIGHT_BOLD : WEIGHT_LIGHT );
     SetFont( aFont );
 
     Size aTabSize = aRect.GetSize();
-- 
1.7.9.5

