diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2016-12-02 02:50:26 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2016-12-02 02:08:27 +0000 |
commit | ff8a29d01afef082741871c7ac40f635a5e2bfad (patch) | |
tree | 0164f5ddbd6890a67a93266cc5680218f83f6e29 | |
parent | 2c3f95d5810521483f990030e0529bbf37fa90f0 (diff) |
Always use FontConfig in UNX
I know Solaris is a snowflake, but it is 2016 already and I think it can
handle FontConfig such fine.
As for the undocumented envvar, lets pretend it never existed because
that is what undocumented feature are. Anyway, it was introduced for
https://bz.apache.org/ooo/show_bug.cgi?id=85483 which is long obsolete
already.
Change-Id: Ib50f129a3828ed2ee5167178c6ff2467d2c8d96c
Reviewed-on: https://gerrit.libreoffice.org/31517
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
-rw-r--r-- | vcl/inc/unx/fontmanager.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/geninst.h | 1 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/fontmanager.cxx | 13 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/fontsubst.cxx | 52 |
4 files changed, 7 insertions, 61 deletions
diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx index 01419dc86b53..9c05f431e319 100644 --- a/vcl/inc/unx/fontmanager.hxx +++ b/vcl/inc/unx/fontmanager.hxx @@ -159,8 +159,6 @@ class VCL_PLUGIN_PUBLIC PrintFontManager fontID m_nNextFontID; std::unordered_map< fontID, PrintFont* > m_aFonts; std::unordered_map< int, FontFamily > m_aFamilyTypes; - std::list< OString > m_aFontDirectories; - std::vector< int > m_aPrivateFontDirectories; utl::MultiAtomProvider* m_pAtoms; // for speeding up findFontFileID std::unordered_map< OString, std::set< fontID >, OStringHash > diff --git a/vcl/inc/unx/geninst.h b/vcl/inc/unx/geninst.h index 060f751a430f..5a9786fd1cd8 100644 --- a/vcl/inc/unx/geninst.h +++ b/vcl/inc/unx/geninst.h @@ -109,7 +109,6 @@ public: // prolly belongs somewhere else ... just a font help static void RegisterFontSubstitutors( PhysicalFontCollection* pFontCollection ); - static int FetchFontSubstitutionFlags(); protected: static void configurePspInfoPrinter( PspSalInfoPrinter* pInfoPrinter, diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx index ce06a652371c..cd414f75e8f6 100644 --- a/vcl/unx/generic/fontmanager/fontmanager.cxx +++ b/vcl/unx/generic/fontmanager/fontmanager.cxx @@ -722,11 +722,6 @@ bool PrintFontManager::analyzeSfntFile( PrintFont* pFont ) const return bSuccess; } -static bool AreFCSubstitutionsEnabled() -{ - return (SalGenericInstance::FetchFontSubstitutionFlags() & 3) == 0; -} - void PrintFontManager::initialize() { #ifdef CALLGRIND_COMPILE @@ -742,8 +737,6 @@ void PrintFontManager::initialize() delete (*it).second; m_nNextFontID = 1; m_aFonts.clear(); - m_aFontDirectories.clear(); - m_aPrivateFontDirectories.clear(); } #if OSL_DEBUG_LEVEL > 1 @@ -768,7 +761,6 @@ void PrintFontManager::initialize() if( !rSalPrivatePath.isEmpty() ) { OString aPath = OUStringToOString( rSalPrivatePath, aEncoding ); - const bool bAreFCSubstitutionsEnabled = AreFCSubstitutionsEnabled(); sal_Int32 nIndex = 0; do { @@ -782,10 +774,7 @@ void PrintFontManager::initialize() // and fontconfig-based substitutions are enabled // then trying to use these app-specific fonts doesn't make sense if( !addFontconfigDir( aToken ) ) - if( bAreFCSubstitutionsEnabled ) - continue; - m_aFontDirectories.push_back( aToken ); - m_aPrivateFontDirectories.push_back( getDirectoryAtom( aToken, true ) ); + continue; } while( nIndex >= 0 ); } diff --git a/vcl/unx/generic/fontmanager/fontsubst.cxx b/vcl/unx/generic/fontmanager/fontsubst.cxx index c362948ade5e..2f050c8c23be 100644 --- a/vcl/unx/generic/fontmanager/fontsubst.cxx +++ b/vcl/unx/generic/fontmanager/fontsubst.cxx @@ -43,55 +43,15 @@ public: bool FindFontSubstitute( FontSelectPattern&, OUString& rMissingCodes ) const override; }; -int SalGenericInstance::FetchFontSubstitutionFlags() -{ - // init font substitution defaults - int nDisableBits = 0; -#ifdef SOLARIS - nDisableBits = 1; // disable "font fallback" here on default -#endif - // apply the environment variable if any - const char* pEnvStr = ::getenv( "SAL_DISABLE_FC_SUBST" ); - if( pEnvStr ) - { - if( (*pEnvStr >= '0') && (*pEnvStr <= '9') ) - nDisableBits = (*pEnvStr - '0'); - else - nDisableBits = ~0U; // no specific bits set: disable all - } - return nDisableBits; -} - void SalGenericInstance::RegisterFontSubstitutors( PhysicalFontCollection* pFontCollection ) { - // init font substitution defaults - int nDisableBits = 0; -#ifdef SOLARIS - nDisableBits = 1; // disable "font fallback" here on default -#endif - // apply the environment variable if any - const char* pEnvStr = ::getenv( "SAL_DISABLE_FC_SUBST" ); - if( pEnvStr ) - { - if( (*pEnvStr >= '0') && (*pEnvStr <= '9') ) - nDisableBits = (*pEnvStr - '0'); - else - nDisableBits = ~0U; // no specific bits set: disable all - } + // register font fallback substitutions + static FcPreMatchSubstitution aSubstPreMatch; + pFontCollection->SetPreMatchHook( &aSubstPreMatch ); - // register font fallback substitutions (unless disabled by bit0) - if( (nDisableBits & 1) == 0 ) - { - static FcPreMatchSubstitution aSubstPreMatch; - pFontCollection->SetPreMatchHook( &aSubstPreMatch ); - } - - // register glyph fallback substitutions (unless disabled by bit1) - if( (nDisableBits & 2) == 0 ) - { - static FcGlyphFallbackSubstitution aSubstFallback; - pFontCollection->SetFallbackHook( &aSubstFallback ); - } + // register glyph fallback substitutions + static FcGlyphFallbackSubstitution aSubstFallback; + pFontCollection->SetFallbackHook( &aSubstFallback ); } static FontSelectPattern GetFcSubstitute(const FontSelectPattern &rFontSelData, OUString& rMissingCodes ) |