diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-10-06 18:16:16 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-10-13 09:19:04 +0000 |
commit | f6d61562d41b8a49449d881da66a3d8fa519487f (patch) | |
tree | 15571322cf3bf8475fe2e1c5d1d0ae9fd38f7c1d /vcl/win | |
parent | bb1d4f8c9a275a20e8795ee36ca3259376746e4f (diff) |
vcl: Make ImplFontCharMap a pImpl and move functions to FontCharMap
To do this, I've made FontCharMap a friend class for ImplFontCharMap,
and have moved the functions directly into FontCharMap. In this patch,
I am attempting to stop the direct use of ImplFontCharMap by anything
other than FontCharMap. However, FontCharMap itself requires a
refcounter, so we will use FontCharMapPtr to access the font character
map.
Change-Id: I509b990a8cbd911c5cc1572c7d24fc5348ca06d9
Reviewed-on: https://gerrit.libreoffice.org/11823
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/source/gdi/salgdi3.cxx | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index cb5be79ee1b6..f3933d960ab0 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -40,6 +40,7 @@ #include <unotools/fontcfg.hxx> #include <vcl/settings.hxx> #include <vcl/sysdata.hxx> +#include <vcl/metric.hxx> #include "fontsubset.hxx" #include "outdev.h" @@ -430,7 +431,7 @@ public: bool FindFontSubstitute( FontSelectPattern&, OUString& rMissingChars ) const; private: HDC mhDC; - bool HasMissingChars( const PhysicalFontFace*, const OUString& rMissingChars ) const; + bool HasMissingChars( PhysicalFontFace*, const OUString& rMissingChars ) const; }; inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC ) @@ -441,10 +442,10 @@ void ImplGetLogFontFromFontSelect( HDC, const FontSelectPattern*, LOGFONTW&, bool /*bTestVerticalAvail*/ ); // does a font face hold the given missing characters? -bool WinGlyphFallbackSubstititution::HasMissingChars( const PhysicalFontFace* pFace, const OUString& rMissingChars ) const +bool WinGlyphFallbackSubstititution::HasMissingChars( PhysicalFontFace* pFace, const OUString& rMissingChars ) const { - const ImplWinFontData* pWinFont = static_cast<const ImplWinFontData*>(pFace); - ImplFontCharMapPtr pCharMap = pWinFont->GetImplFontCharMap(); + ImplWinFontData* pWinFont = static_cast< ImplWinFontData* >(pFace); + FontCharMapPtr pCharMap = pWinFont->GetFontCharMap(); if( !pCharMap ) { // construct a Size structure as the parameter of constructor of class FontSelectPattern @@ -468,7 +469,7 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( const PhysicalFontFace* pF ::DeleteFont( hNewFont ); // get the new charmap - pCharMap = pWinFont->GetImplFontCharMap(); + pCharMap = pWinFont->GetFontCharMap(); } // avoid fonts with unknown CMAP subtables for glyph fallback @@ -531,10 +532,10 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFon // first level fallback: // try use the locale specific default fonts defined in VCL.xcu const PhysicalFontCollection* pFontCollection = ImplGetSVData()->maGDIData.mpScreenFontList; - /*const*/ PhysicalFontFamily* pFontFamily = findDevFontListByLocale(*pFontCollection, aLanguageTag); + PhysicalFontFamily* pFontFamily = findDevFontListByLocale(*pFontCollection, aLanguageTag); if( pFontFamily ) { - const PhysicalFontFace* pFace = pFontFamily->FindBestFontFace( rFontSelData ); + PhysicalFontFace* pFace = pFontFamily->FindBestFontFace( rFontSelData ); if( HasMissingChars( pFace, rMissingChars ) ) { rFontSelData.maSearchName = pFontFamily->GetSearchName(); @@ -550,7 +551,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFon rFontSelData.maSearchName ); if( pFontFamily ) { - const PhysicalFontFace* pFace = pFontFamily->FindBestFontFace( rFontSelData ); + PhysicalFontFace* pFace = pFontFamily->FindBestFontFace( rFontSelData ); if( HasMissingChars( pFace, rMissingChars ) ) { rFontSelData.maSearchName = pFontFamily->GetSearchName(); @@ -569,7 +570,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFon bool bFound = false; for( int i = 0; i < nTestFontCount; ++i ) { - const PhysicalFontFace* pFace = pTestFontList->Get( i ); + PhysicalFontFace* pFace = pTestFontList->Get( i ); bFound = HasMissingChars( pFace, rMissingChars ); if( !bFound ) continue; @@ -1224,7 +1225,7 @@ bool ImplWinFontData::IsGSUBstituted( sal_UCS4 cChar ) const return( maGsubTable.find( cChar ) != maGsubTable.end() ); } -const ImplFontCharMapPtr ImplWinFontData::GetImplFontCharMap() const +FontCharMapPtr ImplWinFontData::GetFontCharMap() const { if( !mpUnicodeMap ) return NULL; @@ -1299,13 +1300,15 @@ void ImplWinFontData::ReadCmapTable( HDC hDC ) const aResult.mbSymbolic = bIsSymbolFont; if( aResult.mnRangeCount > 0 ) { - ImplFontCharMapPtr pUnicodeMap( new ImplFontCharMap( aResult ) ); + FontCharMapPtr pUnicodeMap(new FontCharMap(aResult)); mpUnicodeMap = pUnicodeMap; } } if( !mpUnicodeMap ) - mpUnicodeMap = ImplFontCharMap::GetDefaultMap( bIsSymbolFont ); + { + mpUnicodeMap = FontCharMap::GetDefaultMap( bIsSymbolFont ); + } } void ImplWinFontData::GetFontCapabilities( HDC hDC ) const @@ -1699,11 +1702,14 @@ sal_uLong WinSalGraphics::GetKernPairs() return mnFontKernPairCount; } -const ImplFontCharMapPtr WinSalGraphics::GetImplFontCharMap() const +const FontCharMapPtr WinSalGraphics::GetFontCharMap() const { if( !mpWinFontData[0] ) - return ImplFontCharMap::GetDefaultMap(); - return mpWinFontData[0]->GetImplFontCharMap(); + { + FontCharMapPtr pDefFontCharMap( new FontCharMap() ); + return pDefFontCharMap; + } + return mpWinFontData[0]->GetFontCharMap(); } bool WinSalGraphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const @@ -2482,7 +2488,7 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile, if( aRawCffData.get() ) { pWinFontData->UpdateFromHDC( getHDC() ); - ImplFontCharMapPtr pCharMap = pWinFontData->GetImplFontCharMap(); + FontCharMapPtr pCharMap = pWinFontData->GetFontCharMap(); sal_GlyphId aRealGlyphIds[ 256 ]; for( int i = 0; i < nGlyphCount; ++i ) @@ -2732,7 +2738,7 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont, rUnicodeEnc.clear(); } const ImplWinFontData* pWinFont = static_cast<const ImplWinFontData*>(pFont); - ImplFontCharMapPtr pMap = pWinFont->GetImplFontCharMap(); + FontCharMapPtr pMap = pWinFont->GetFontCharMap(); DBG_ASSERT( pMap && pMap->GetCharCount(), "no map" ); int nCharCount = pMap->GetCharCount(); |