[Libreoffice-commits] core.git: vcl/inc vcl/unx

Khaled Hosny khaledhosny at eglug.org
Fri Dec 2 02:08:53 UTC 2016


 vcl/inc/unx/fontmanager.hxx                 |    2 -
 vcl/inc/unx/geninst.h                       |    1 
 vcl/unx/generic/fontmanager/fontmanager.cxx |   13 -------
 vcl/unx/generic/fontmanager/fontsubst.cxx   |   52 +++-------------------------
 4 files changed, 7 insertions(+), 61 deletions(-)

New commits:
commit ff8a29d01afef082741871c7ac40f635a5e2bfad
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Fri Dec 2 02:50:26 2016 +0200

    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 at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx
index 01419dc..9c05f43 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 060f751..5a9786f 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 ce06a65..cd414f7 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 c362948..2f050c8 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 )


More information about the Libreoffice-commits mailing list