diff options
Diffstat (limited to 'vcl/win/gdi/salfont.cxx')
-rw-r--r-- | vcl/win/gdi/salfont.cxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index 1bd142366710..e7dd594793f2 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -1470,6 +1470,17 @@ sal_uInt16 WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel if( mpWinFontData[ nFallbackLevel ] ) mpWinFontData[ nFallbackLevel ]->UpdateFromHDC( getHDC() ); + if( !nFallbackLevel ) + { + mbFontKernInit = TRUE; + if ( mpFontKernPairs ) + { + delete[] mpFontKernPairs; + mpFontKernPairs = NULL; + } + mnFontKernPairCount = 0; + } + // some printers have higher internal resolution, so their // text output would be different from what we calculated // => suggest DrawTextArray to workaround this problem @@ -1556,6 +1567,35 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataPtr& rxFontMetric, int nFa rxFontMetric->SetMinKashida( GetMinKashidaWidth() ); } +sal_uLong WinSalGraphics::GetKernPairs() +{ + if ( mbFontKernInit ) + { + if( mpFontKernPairs ) + { + delete[] mpFontKernPairs; + mpFontKernPairs = NULL; + } + mnFontKernPairCount = 0; + + KERNINGPAIR* pPairs = NULL; + int nCount = ::GetKerningPairsW( getHDC(), 0, NULL ); + if( nCount ) + { + pPairs = new KERNINGPAIR[ nCount+1 ]; + mpFontKernPairs = pPairs; + mnFontKernPairCount = nCount; + ::GetKerningPairsW( getHDC(), nCount, pPairs ); + } + + mbFontKernInit = FALSE; + + std::sort( mpFontKernPairs, mpFontKernPairs + mnFontKernPairCount, ImplCmpKernData ); + } + + return mnFontKernPairCount; +} + const FontCharMapPtr WinSalGraphics::GetFontCharMap() const { if( !mpWinFontData[0] ) |