From b10c8f3fce37d72019f4767fdb9612b46845aecd Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 21 Aug 2018 08:38:57 +0100 Subject: turn the cache around to work on LogicalFontInstance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: Caolán McNamara --- vcl/source/font/PhysicalFontCollection.cxx | 2 +- vcl/source/font/PhysicalFontFace.cxx | 2 +- vcl/source/font/fontcache.cxx | 8 ++++---- vcl/source/font/fontinstance.cxx | 5 ++--- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'vcl/source/font') 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 PhysicalFontFace::CreateFontInstance(const FontSelectPattern& rFSD) const +rtl::Reference 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 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 ImplFontCache::GetFontInstance( PhysicalFontCollection const * pFontList, - FontSelectPattern& aFontSelData ) + FontSelectPatternAttributes& aFontSelData ) { rtl::Reference pFontInstance; PhysicalFontFamily* pFontFamily = nullptr; @@ -192,7 +192,7 @@ rtl::Reference ImplFontCache::GetFontInstance( PhysicalFont } rtl::Reference 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 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(rFontFace)) { - const_cast(&m_aFontSelData)->mpFontInstance = this; } void LogicalFontInstance::SetNonAntialiased(bool bNonAntialiased) { - const_cast(&m_aFontSelData)->mbNonAntialiased = bNonAntialiased; + const_cast(&m_aFontSelData)->mbNonAntialiased = bNonAntialiased; } LogicalFontInstance::~LogicalFontInstance() -- cgit