[ooo-build-commit] .: vcl/win

Caolán McNamara caolan at kemper.freedesktop.org
Fri Oct 1 02:12:23 PDT 2010


 vcl/win/inc/salgdi.h           |    2 +-
 vcl/win/source/gdi/salgdi3.cxx |   15 +++++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 194afa4b0edb4601905a6fd156a3f8510d5d5056
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Oct 1 10:12:17 2010 +0100

    #i112247# Fix this up for windows as well

diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h
index 549ff51..2084ac7 100755
--- a/vcl/win/inc/salgdi.h
+++ b/vcl/win/inc/salgdi.h
@@ -282,7 +282,7 @@ public:
     // set the font
     virtual USHORT         SetFont( ImplFontSelectData*, int nFallbackLevel );
     // get the current font's etrics
-    virtual void			GetFontMetric( ImplFontMetricData* );
+    virtual void			GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
     // get kernign pairs of the current font
     // return only PairCount if (pKernPairs == NULL)
     virtual ULONG			GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index 707a2ea..f3c2f0a 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -1760,8 +1760,11 @@ USHORT WinSalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLevel )
 
 // -----------------------------------------------------------------------
 
-void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
+void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel )
 {
+    // temporarily change the HDC to the font in the fallback level
+    HFONT hOldFont = SelectFont( mhDC, mhFonts[i] );
+
     if ( aSalShlData.mbWNT )
     {
         wchar_t aFaceName[LF_FACESIZE+60];
@@ -1775,8 +1778,12 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
             pMetric->maName = ImplSalGetUniString( aFaceName );
     }
 
+    // get the font metric
     TEXTMETRICA aWinMetric;
-    if( !GetTextMetricsA( mhDC, &aWinMetric ) )
+    const bool bOK = GetTextMetricsA( mhDC, &aWinMetric );
+    // restore the HDC to the font in the base level
+    SelectFont( mhDC, hOldFont );
+    if( !bOk )
         return;
 
     // device independent font attributes
@@ -1815,7 +1822,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
     // #107888# improved metric compatibility for Asian fonts...
     // TODO: assess workaround below for CWS >= extleading
     // TODO: evaluate use of aWinMetric.sTypo* members for CJK
-    if( mpWinFontData[0] && mpWinFontData[0]->SupportsCJK() )
+    if( mpWinFontData[nFallbackLevel] && mpWinFontData[nFallbackLevel]->SupportsCJK() )
     {
         pMetric->mnIntLeading += pMetric->mnExtLeading;
 
@@ -1836,7 +1843,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
 
         // #109280# HACK korean only: increase descent for wavelines and impr
         if( !aSalShlData.mbWNT )
-            if( mpWinFontData[0]->SupportsKorean() )
+            if( mpWinFontData[nFallbackLevel]->SupportsKorean() )
                 pMetric->mnDescent += pMetric->mnExtLeading;
     }
 


More information about the ooo-build-commit mailing list