[Libreoffice-commits] .: 3 commits - vcl/inc vcl/win

Tor Lillqvist tml at kemper.freedesktop.org
Wed May 9 03:39:28 PDT 2012


 vcl/inc/win/salgdi.h             |    7 -----
 vcl/win/source/gdi/salgdi3.cxx   |    9 -------
 vcl/win/source/gdi/winlayout.cxx |   50 ++-------------------------------------
 3 files changed, 3 insertions(+), 63 deletions(-)

New commits:
commit 96f79ea7c326db138aa3188e129c6e9b4d78cbaa
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Wed May 9 13:33:19 2012 +0300

    GNG_VERT_HACK has been hardcoded since 2004, so why bother with ifdefs
    
    Change-Id: I629a8af49d95b46390e5fe72f44f92a89379b57a

diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 1f279f3..698bf57 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -53,10 +53,6 @@ class ImplFontAttrCache;
 #define RGB_TO_PALRGB(nRGB)         ((nRGB)|0x02000000)
 #define PALRGB_TO_RGB(nPalRGB)      ((nPalRGB)&0x00ffffff)
 
-// win32 platform specific options. Move them to the PMK file?
-
-#define GNG_VERT_HACK
-
 #ifdef ENABLE_GRAPHITE
 class RawFontData;
 class GrFontData
@@ -144,7 +140,6 @@ private:
     void                    ReadCmapTable( HDC ) const;
     void                    GetFontCapabilities( HDC hDC ) const;
 
-#ifdef GNG_VERT_HACK
     void                    ReadGsubTable( HDC ) const;
 
     typedef boost::unordered_set<sal_UCS4> UcsHashSet;
@@ -153,7 +148,6 @@ private:
 public:
     bool                    HasGSUBstitutions( HDC ) const;
     bool                    IsGSUBstituted( sal_UCS4 ) const;
-#endif // GNG_VERT_HACK
 };
 
 // ------------------
commit 0947d09c8aa71e5c413a3b637d6402b0f41239e1
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Wed May 9 13:30:11 2012 +0300

    GCP_KERN_HACK has been hardcoded since 2002, so why bother with ifdefs
    
    Change-Id: I7e37289aba503310c54026d5a8bcbf8e4d51fb6c

diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 974d16c..1f279f3 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -55,7 +55,6 @@ class ImplFontAttrCache;
 
 // win32 platform specific options. Move them to the PMK file?
 
-#define GCP_KERN_HACK
 #define GNG_VERT_HACK
 
 #ifdef ENABLE_GRAPHITE
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index 4d866f9..79ff375 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -69,9 +69,7 @@
 #include "outdev.h"         // for ImplGlyphFallbackFontSubstitution
 #include "sft.hxx"
 
-#ifdef GCP_KERN_HACK
 #include <algorithm>
-#endif
 
 #ifdef ENABLE_GRAPHITE
 #include <graphite2/Font.h>
@@ -1797,17 +1795,10 @@ sal_uLong WinSalGraphics::GetKernPairs( sal_uLong nPairs, ImplKernPairData* pKer
         int nCount = ::GetKerningPairsW( mhDC, 0, NULL );
         if( nCount )
         {
-            #ifdef GCP_KERN_HACK
             pPairs = new KERNINGPAIR[ nCount+1 ];
             mpFontKernPairs = pPairs;
             mnFontKernPairCount = nCount;
             ::GetKerningPairsW( mhDC, nCount, pPairs );
-            #else // GCP_KERN_HACK
-            pPairs = pKernPairs;
-            nCount = (nCount < nPairs) : nCount : nPairs;
-            ::GetKerningPairsW( mhDC, nCount, pPairs );
-            return nCount;
-            #endif // GCP_KERN_HACK
         }
 
         mbFontKernInit = FALSE;
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index db52d43..72f9cf3 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -48,9 +48,7 @@
 #define alloca _alloca
 #endif
 
-#ifdef GCP_KERN_HACK
-    #include <algorithm>
-#endif // GCP_KERN_HACK
+#include <algorithm>
 
 #include <usp10.h>
 #include <shlwapi.h>
@@ -87,7 +85,6 @@ public:
 private:
     // TODO: also add HFONT??? Watch out for issues with too many active fonts...
 
-#ifdef GCP_KERN_HACK
 public:
     bool                    HasKernData() const;
     void                    SetKernData( int, const KERNINGPAIR* );
@@ -95,7 +92,6 @@ public:
 private:
     KERNINGPAIR*            mpKerningPairs;
     int                     mnKerningPairs;
-#endif // GCP_KERN_HACK
 
 public:
     SCRIPT_CACHE&           GetScriptCache() const
@@ -389,13 +385,6 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
     if( rArgs.mnFlags & (SAL_LAYOUT_KERNING_PAIRS | SAL_LAYOUT_KERNING_ASIAN) )
         mpGlyphOrigAdvs = new int[ mnGlyphCount ];
 
-#ifndef GCP_KERN_HACK
-    DWORD nGcpOption = 0;
-    // enable kerning if requested
-    if( rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS )
-        nGcpOption |= GCP_USEKERNING;
-#endif // GCP_KERN_HACK
-
     for( i = 0; i < mnGlyphCount; ++i )
         mpOutGlyphs[i] = pBidiStr[ i ];
     mnWidth = 0;
@@ -478,18 +467,11 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
             mpGlyphOrigAdvs[i] = mnNotdefWidth;
     }
 
-#ifdef GCP_KERN_HACK
     // apply kerning if the layout engine has not yet done it
     if( rArgs.mnFlags & (SAL_LAYOUT_KERNING_ASIAN|SAL_LAYOUT_KERNING_PAIRS) )
     {
-#else // GCP_KERN_HACK
-    // apply just asian kerning
-    if( rArgs.mnFlags & SAL_LAYOUT_KERNING_ASIAN )
-    {
-        if( !(rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS) )
-#endif // GCP_KERN_HACK
-            for( i = 0; i < mnGlyphCount; ++i )
-                mpGlyphOrigAdvs[i] = mpGlyphAdvances[i];
+        for( i = 0; i < mnGlyphCount; ++i )
+            mpGlyphOrigAdvs[i] = mpGlyphAdvances[i];
 
         // #99658# also apply asian kerning on the substring border
         int nLen = mnGlyphCount;
@@ -497,7 +479,6 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
             ++nLen;
         for( i = 1; i < nLen; ++i )
         {
-#ifdef GCP_KERN_HACK
             if( rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS )
             {
                 int nKernAmount = mrWinFontEntry.GetKerning( pBidiStr[i-1], pBidiStr[i] );
@@ -505,7 +486,6 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
                 mnWidth += nKernAmount;
             }
             else if( rArgs.mnFlags & SAL_LAYOUT_KERNING_ASIAN )
-#endif // GCP_KERN_HACK
 
             if( ( (0x3000 == (0xFF00 & pBidiStr[i-1])) || (0x2010 == (0xFFF0 & pBidiStr[i-1])) || (0xFF00 == (0xFF00 & pBidiStr[i-1])))
             &&  ( (0x3000 == (0xFF00 & pBidiStr[i])) || (0x2010 == (0xFFF0 & pBidiStr[i])) || (0xFF00 == (0xFF00 & pBidiStr[i])) ) )
@@ -2927,7 +2907,6 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
     }
     else
     {
-#ifdef GCP_KERN_HACK
         if( (rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS) && !rFontInstance.HasKernData() )
         {
             // TODO: directly cache kerning info in the rFontInstance
@@ -2935,7 +2914,6 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
             GetKernPairs( 0, NULL );
             rFontInstance.SetKernData( mnFontKernPairCount, mpFontKernPairs );
         }
-#endif // GCP_KERN_HACK
 
         BYTE eCharSet = ANSI_CHARSET;
         if( mpLogFont )
@@ -2984,9 +2962,7 @@ ImplWinFontEntry::~ImplWinFontEntry()
 {
     if( maScriptCache != NULL )
         ScriptFreeCache( &maScriptCache );
-#ifdef GCP_KERN_HACK
     delete[] mpKerningPairs;
-#endif // GCP_KERN_HACK
 }
 
 // -----------------------------------------------------------------------
commit 7a3061db050d1727240bad9c3e4142f2a94944bf
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Wed May 9 13:13:43 2012 +0300

    USE_UNISCRIBE has been hardcoded since 2009, so why bother with ifdefs
    
    Change-Id: I16210b01b67e0bc4c817a0b1480483dd6237a5ba

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index a6387eb..db52d43 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -52,13 +52,9 @@
     #include <algorithm>
 #endif // GCP_KERN_HACK
 
-
-#define USE_UNISCRIBE
-#ifdef USE_UNISCRIBE
 #include <usp10.h>
 #include <shlwapi.h>
 #include <winver.h>
-#endif // USE_UNISCRIBE
 
 #include <boost/unordered_map.hpp>
 #include <set>
@@ -101,13 +97,11 @@ private:
     int                     mnKerningPairs;
 #endif // GCP_KERN_HACK
 
-#ifdef USE_UNISCRIBE
 public:
     SCRIPT_CACHE&           GetScriptCache() const
                             { return maScriptCache; }
 private:
     mutable SCRIPT_CACHE    maScriptCache;
-#endif // USE_UNISCRIBE
 
 public:
     int                     GetCachedGlyphWidth( int nCharCode ) const;
@@ -149,10 +143,8 @@ public:
     float               GetFontScale() const    { return mfFontScale; }
     HFONT               DisableFontScaling( void) const;
 
-#ifdef USE_UNISCRIBE
     SCRIPT_CACHE&       GetScriptCache() const
                             { return mrWinFontEntry.GetScriptCache(); }
-#endif // USE_UNISCRIBE
 
 protected:
     HDC                 mhDC;               // WIN32 device handle
@@ -1013,8 +1005,6 @@ void SimpleWinLayout::Simplify( bool /*bIsBase*/ )
 
 // =======================================================================
 
-#ifdef USE_UNISCRIBE
-
 struct VisualItem
 {
 public:
@@ -2697,8 +2687,6 @@ bool UniscribeLayout::IsKashidaPosValid ( int nCharPos ) const
     return true;
 }
 
-#endif // USE_UNISCRIBE
-
 #ifdef ENABLE_GRAPHITE
 
 class GraphiteLayoutWinImpl : public GraphiteLayout
@@ -2921,7 +2909,6 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
     const ImplWinFontData& rFontFace = *mpWinFontData[ nFallbackLevel ];
     ImplWinFontEntry& rFontInstance = *mpWinFontEntry[ nFallbackLevel ];
 
-#if defined( USE_UNISCRIBE )
     if( !(rArgs.mnFlags & SAL_LAYOUT_COMPLEX_DISABLED)
     &&   (bUspInited || InitUSP()) )   // CTL layout engine
     {
@@ -2939,7 +2926,6 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
         // constructor might become invalid too early
     }
     else
-#endif // USE_UNISCRIBE
     {
 #ifdef GCP_KERN_HACK
         if( (rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS) && !rFontInstance.HasKernData() )
@@ -2989,19 +2975,15 @@ ImplWinFontEntry::ImplWinFontEntry( FontSelectPattern& rFSD )
 ,    mnMinKashidaWidth( -1 )
 ,    mnMinKashidaGlyph( -1 )
 {
-#ifdef USE_UNISCRIBE
     maScriptCache = NULL;
-#endif // USE_UNISCRIBE
 }
 
 // -----------------------------------------------------------------------
 
 ImplWinFontEntry::~ImplWinFontEntry()
 {
-#ifdef USE_UNISCRIBE
     if( maScriptCache != NULL )
         ScriptFreeCache( &maScriptCache );
-#endif // USE_UNISCRIBE
 #ifdef GCP_KERN_HACK
     delete[] mpKerningPairs;
 #endif // GCP_KERN_HACK
@@ -3054,7 +3036,6 @@ bool ImplWinFontEntry::InitKashidaHandling( HDC hDC )
     // initialize the kashida width
     mnMinKashidaWidth = 0;
     mnMinKashidaGlyph = 0;
-#ifdef USE_UNISCRIBE
     if (bUspInited || InitUSP())
     {
         SCRIPT_FONTPROPERTIES aFontProperties;
@@ -3066,7 +3047,6 @@ bool ImplWinFontEntry::InitKashidaHandling( HDC hDC )
         mnMinKashidaWidth = aFontProperties.iKashidaWidth;
         mnMinKashidaGlyph = aFontProperties.wgKashida;
     }
-#endif // USE_UNISCRIBE
 
     return true;
 }


More information about the Libreoffice-commits mailing list