Kaydet (Commit) 0947d09c authored tarafından Tor Lillqvist's avatar Tor Lillqvist

GCP_KERN_HACK has been hardcoded since 2002, so why bother with ifdefs

Change-Id: I7e37289aba503310c54026d5a8bcbf8e4d51fb6c
üst 7a3061db
......@@ -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
......
......@@ -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;
......
......@@ -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
}
// -----------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment