diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-20 12:35:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-08-21 21:36:58 +0200 |
commit | fa0ea0257676d7f96938216ac958a08d7c9a364c (patch) | |
tree | e413f20b2facc0a04df1717e64c0b71a5c783afc /vcl/unx | |
parent | fb4a58fcaefc2f437c0ec4a7cb40281aef4162da (diff) |
change FindFontSubstitute to operate on FontSelectPatternAttributes
it remains to be seen if we need the the returned mpFontInstance
of the coretext impl
Change-Id: I48f73188250c3eb014f16ffe0a735191da5cb25b
Reviewed-on: https://gerrit.libreoffice.org/59322
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/fontmanager/fontconfig.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/fontsubst.cxx | 27 |
2 files changed, 15 insertions, 14 deletions
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index 10cb3a76f3fa..633f3ab4f914 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -862,7 +862,7 @@ IMPL_LINK_NOARG(PrintFontManager, autoInstallFontLangSupport, Timer *, void) m_aCurrentRequests.clear(); } -void PrintFontManager::Substitute( FontSelectPattern &rPattern, OUString& rMissingCodes ) +void PrintFontManager::Substitute(FontSelectPatternAttributes &rPattern, OUString& rMissingCodes) { FontCfgWrapper& rWrapper = FontCfgWrapper::get(); diff --git a/vcl/unx/generic/fontmanager/fontsubst.cxx b/vcl/unx/generic/fontmanager/fontsubst.cxx index 11586ad21382..f43ed146e060 100644 --- a/vcl/unx/generic/fontmanager/fontsubst.cxx +++ b/vcl/unx/generic/fontmanager/fontsubst.cxx @@ -28,8 +28,8 @@ class FcPreMatchSubstitution : public ImplPreMatchFontSubstitution { public: - bool FindFontSubstitute( FontSelectPattern& ) const override; - typedef ::std::pair<FontSelectPattern, FontSelectPattern> value_type; + bool FindFontSubstitute( FontSelectPatternAttributes& ) const override; + typedef ::std::pair<FontSelectPatternAttributes, FontSelectPatternAttributes> value_type; private: typedef ::std::list<value_type> CachedFontMapType; mutable CachedFontMapType maCachedFontMap; @@ -40,7 +40,7 @@ class FcGlyphFallbackSubstitution { // TODO: add a cache public: - bool FindFontSubstitute( FontSelectPattern&, OUString& rMissingCodes ) const override; + bool FindFontSubstitute(FontSelectPatternAttributes&, LogicalFontInstance* pLogicalFont, OUString& rMissingCodes) const override; }; void SalGenericInstance::RegisterFontSubstitutors( PhysicalFontCollection* pFontCollection ) @@ -54,9 +54,9 @@ void SalGenericInstance::RegisterFontSubstitutors( PhysicalFontCollection* pFont pFontCollection->SetFallbackHook( &aSubstFallback ); } -static FontSelectPattern GetFcSubstitute(const FontSelectPattern &rFontSelData, OUString& rMissingCodes ) +static FontSelectPatternAttributes GetFcSubstitute(const FontSelectPatternAttributes &rFontSelData, OUString& rMissingCodes) { - FontSelectPattern aSubstituted(rFontSelData); + FontSelectPatternAttributes aSubstituted(rFontSelData); psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); rMgr.Substitute(aSubstituted, rMissingCodes); return aSubstituted; @@ -79,9 +79,9 @@ namespace class equal { private: - const FontSelectPattern& mrAttributes; + const FontSelectPatternAttributes& mrAttributes; public: - explicit equal(const FontSelectPattern& rAttributes) + explicit equal(const FontSelectPatternAttributes& rAttributes) : mrAttributes(rAttributes) { } @@ -90,7 +90,7 @@ namespace }; } -bool FcPreMatchSubstitution::FindFontSubstitute( FontSelectPattern &rFontSelData ) const +bool FcPreMatchSubstitution::FindFontSubstitute(FontSelectPatternAttributes &rFontSelData) const { // We don't actually want to talk to Fontconfig at all for symbol fonts if( rFontSelData.IsSymbolFont() ) @@ -104,13 +104,13 @@ bool FcPreMatchSubstitution::FindFontSubstitute( FontSelectPattern &rFontSelData //different fonts depending on fontsize, bold, etc settings so don't cache //just on the name, cache map all the input and all the output not just map //from original selection to output fontname - FontSelectPattern& rPatternAttributes = rFontSelData; + FontSelectPatternAttributes& rPatternAttributes = rFontSelData; CachedFontMapType &rCachedFontMap = maCachedFontMap; CachedFontMapType::iterator itr = std::find_if(rCachedFontMap.begin(), rCachedFontMap.end(), equal(rPatternAttributes)); if (itr != rCachedFontMap.end()) { // Cached substitution - rFontSelData.copyAttributes(itr->second); + rFontSelData = itr->second; if (itr != rCachedFontMap.begin()) { // MRU, move it to the front @@ -120,7 +120,7 @@ bool FcPreMatchSubstitution::FindFontSubstitute( FontSelectPattern &rFontSelData } OUString aDummy; - const FontSelectPattern aOut = GetFcSubstitute( rFontSelData, aDummy ); + const FontSelectPatternAttributes aOut = GetFcSubstitute( rFontSelData, aDummy ); if( aOut.maSearchName.isEmpty() ) return false; @@ -155,7 +155,8 @@ bool FcPreMatchSubstitution::FindFontSubstitute( FontSelectPattern &rFontSelData return bHaveSubstitute; } -bool FcGlyphFallbackSubstitution::FindFontSubstitute( FontSelectPattern& rFontSelData, +bool FcGlyphFallbackSubstitution::FindFontSubstitute(FontSelectPatternAttributes& rFontSelData, + LogicalFontInstance* /*pLogicalFont*/, OUString& rMissingCodes ) const { // We don't actually want to talk to Fontconfig at all for symbol fonts @@ -165,7 +166,7 @@ bool FcGlyphFallbackSubstitution::FindFontSubstitute( FontSelectPattern& rFontSe if ( IsStarSymbol(rFontSelData.maSearchName) ) return false; - const FontSelectPattern aOut = GetFcSubstitute( rFontSelData, rMissingCodes ); + const FontSelectPatternAttributes aOut = GetFcSubstitute( rFontSelData, rMissingCodes ); // TODO: cache the unicode + srcfont specific result // FC doing it would be preferable because it knows the invariables // e.g. FC knows the FC rule that all Arial gets replaced by LiberationSans |