diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-21 08:38:57 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-08-22 00:24:15 +0200 |
commit | b10c8f3fce37d72019f4767fdb9612b46845aecd (patch) | |
tree | b6a74975522b301cb9892021a32135ee75bf7a2d /vcl/source | |
parent | 4790dd4d957827f9b2eeffe23ce1a8d63635df0d (diff) |
turn the cache around to work on LogicalFontInstance
instead of a FontSelectPattern with an associated LogicalFontInstance
use a LogicalFontInstance with owned FontSelectPatternAttributes
Change-Id: I939f84731fcb8db5ff6484dcfbd2f9199bb50d23
Reviewed-on: https://gerrit.libreoffice.org/59388
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/font/PhysicalFontCollection.cxx | 2 | ||||
-rw-r--r-- | vcl/source/font/PhysicalFontFace.cxx | 2 | ||||
-rw-r--r-- | vcl/source/font/fontcache.cxx | 8 | ||||
-rw-r--r-- | vcl/source/font/fontinstance.cxx | 5 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.hxx | 2 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 8 |
6 files changed, 12 insertions, 15 deletions
diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx index fc5a08ca8feb..821da5cdf937 100644 --- a/vcl/source/font/PhysicalFontCollection.cxx +++ b/vcl/source/font/PhysicalFontCollection.cxx @@ -943,7 +943,7 @@ static bool FindMetricCompatibleFont(FontSelectPatternAttributes& rFontSelData) return false; } -PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( FontSelectPattern& rFSD ) const +PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( FontSelectPatternAttributes& rFSD ) const { // give up if no fonts are available if( !Count() ) diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx index a244e7966eb6..5aa39e677dcb 100644 --- a/vcl/source/font/PhysicalFontFace.cxx +++ b/vcl/source/font/PhysicalFontFace.cxx @@ -37,7 +37,7 @@ PhysicalFontFace::PhysicalFontFace( const FontAttributes& rDFA ) SetSymbolFlag( true ); } -rtl::Reference<LogicalFontInstance> PhysicalFontFace::CreateFontInstance(const FontSelectPattern& rFSD) const +rtl::Reference<LogicalFontInstance> PhysicalFontFace::CreateFontInstance(const FontSelectPatternAttributes& rFSD) const { return new LogicalFontInstance(*this, rFSD); } diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx index 5ab66052e9c1..4272fd1ef113 100644 --- a/vcl/source/font/fontcache.cxx +++ b/vcl/source/font/fontcache.cxx @@ -95,12 +95,12 @@ rtl::Reference<LogicalFontInstance> ImplFontCache::GetFontInstance( PhysicalFont const vcl::Font& rFont, const Size& rSize, float fExactHeight ) { // initialize internal font request object - FontSelectPattern aFontSelData(rFont, rFont.GetFamilyName(), rSize, fExactHeight); + FontSelectPatternAttributes aFontSelData(rFont, rFont.GetFamilyName(), rSize, fExactHeight); return GetFontInstance( pFontList, aFontSelData ); } rtl::Reference<LogicalFontInstance> ImplFontCache::GetFontInstance( PhysicalFontCollection const * pFontList, - FontSelectPattern& aFontSelData ) + FontSelectPatternAttributes& aFontSelData ) { rtl::Reference<LogicalFontInstance> pFontInstance; PhysicalFontFamily* pFontFamily = nullptr; @@ -192,7 +192,7 @@ rtl::Reference<LogicalFontInstance> ImplFontCache::GetFontInstance( PhysicalFont } rtl::Reference<LogicalFontInstance> ImplFontCache::GetGlyphFallbackFont( PhysicalFontCollection const * pFontCollection, - FontSelectPattern& rFontSelData, int nFallbackLevel, OUString& rMissingCodes ) + FontSelectPatternAttributes& rFontSelData, LogicalFontInstance* pFontInstance, int nFallbackLevel, OUString& rMissingCodes ) { // get a candidate font for glyph fallback // unless the previously selected font got a device specific substitution @@ -212,7 +212,7 @@ rtl::Reference<LogicalFontInstance> ImplFontCache::GetGlyphFallbackFont( Physica if (nFallbackLevel == 1) pFallbackData = pFontCollection->FindFontFamily("EUDC"); if (!pFallbackData) - pFallbackData = pFontCollection->GetGlyphFallbackFont(rFontSelData, rFontSelData.mpFontInstance.get(), rMissingCodes, nFallbackLevel-1); + pFallbackData = pFontCollection->GetGlyphFallbackFont(rFontSelData, pFontInstance, rMissingCodes, nFallbackLevel-1); // escape when there are no font candidates if( !pFallbackData ) return nullptr; diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx index 25c637706ca6..218787280228 100644 --- a/vcl/source/font/fontinstance.cxx +++ b/vcl/source/font/fontinstance.cxx @@ -40,7 +40,7 @@ namespace std } -LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, const FontSelectPattern& rFontSelData ) +LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, const FontSelectPatternAttributes& rFontSelData ) : mxFontMetric( new ImplFontMetricData( rFontSelData )) , mpConversion( nullptr ) , mnLineHeight( 0 ) @@ -53,12 +53,11 @@ LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, cons , m_nAveWidthFactor(1.0f) , m_pFontFace(&const_cast<PhysicalFontFace&>(rFontFace)) { - const_cast<FontSelectPattern*>(&m_aFontSelData)->mpFontInstance = this; } void LogicalFontInstance::SetNonAntialiased(bool bNonAntialiased) { - const_cast<FontSelectPattern*>(&m_aFontSelData)->mbNonAntialiased = bNonAntialiased; + const_cast<FontSelectPatternAttributes*>(&m_aFontSelData)->mbNonAntialiased = bNonAntialiased; } LogicalFontInstance::~LogicalFontInstance() diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index acafb54f587e..941078a0589e 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -48,7 +48,7 @@ #include <PhysicalFontFace.hxx> class StyleSettings; -class FontSelectPattern; +class FontSelectPatternAttributes; class FontSubsetInfo; class ZCodec; class EncHashTransporter; diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 9b9479b25444..32e76283678b 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -1366,18 +1366,16 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt rLayoutArgs.ResetPos(); OUString aMissingCodes = aMissingCodeBuf.makeStringAndClear(); - FontSelectPattern aFontSelData(mpFontInstance->GetFontSelectPattern()); + FontSelectPatternAttributes aFontSelData(mpFontInstance->GetFontSelectPattern()); // try if fallback fonts support the missing code units for( int nFallbackLevel = 1; nFallbackLevel < MAX_FALLBACK; ++nFallbackLevel ) { // find a font family suited for glyph fallback - // GetGlyphFallbackFont() needs a valid aFontSelData.mpFontInstance + // GetGlyphFallbackFont() needs a valid FontInstance // if the system-specific glyph fallback is active - aFontSelData.mpFontInstance = mpFontInstance; // reset the fontinstance to base-level - rtl::Reference<LogicalFontInstance> pFallbackFont = mxFontCache->GetGlyphFallbackFont( mxFontCollection.get(), - aFontSelData, nFallbackLevel, aMissingCodes ); + aFontSelData, mpFontInstance.get(), nFallbackLevel, aMissingCodes ); if( !pFallbackFont ) break; |