summaryrefslogtreecommitdiff
path: root/psprint/source/fontmanager
diff options
context:
space:
mode:
Diffstat (limited to 'psprint/source/fontmanager')
-rw-r--r--psprint/source/fontmanager/fontconfig.cxx16
-rw-r--r--psprint/source/fontmanager/fontmanager.cxx25
2 files changed, 28 insertions, 13 deletions
diff --git a/psprint/source/fontmanager/fontconfig.cxx b/psprint/source/fontmanager/fontconfig.cxx
index 6270f52efcd9..c81962ef20b7 100644
--- a/psprint/source/fontmanager/fontconfig.cxx
+++ b/psprint/source/fontmanager/fontconfig.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fontconfig.cxx,v $
- * $Revision: 1.30 $
+ * $Revision: 1.30.24.2 $
*
* This file is part of OpenOffice.org.
*
@@ -91,7 +91,6 @@ using namespace rtl;
class FontCfgWrapper
{
oslModule m_pLib;
- FcConfig* m_pDefConfig;
FcFontSet* m_pOutlineSet;
FcBool (*m_pFcInit)();
@@ -140,7 +139,6 @@ public:
bool isValid() const
{ return m_pLib != NULL;}
- FcConfig* getDefConfig() { return m_pDefConfig; }
FcFontSet* getFontSet();
FcBool FcInit()
@@ -252,7 +250,6 @@ oslGenericFunction FontCfgWrapper::loadSymbol( const char* pSymbol )
FontCfgWrapper::FontCfgWrapper()
: m_pLib( NULL ),
- m_pDefConfig( NULL ),
m_pOutlineSet( NULL )
{
OUString aLib( RTL_CONSTASCII_USTRINGPARAM( "libfontconfig.so.1" ) );
@@ -379,8 +376,7 @@ FontCfgWrapper::FontCfgWrapper()
FcInit();
- m_pDefConfig = FcConfigGetCurrent();
- if( ! m_pDefConfig )
+ if( ! FcConfigGetCurrent() )
{
osl_unloadModule( (oslModule)m_pLib );
m_pLib = NULL;
@@ -394,7 +390,7 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
add only acceptable outlined fonts to our config,
for future fontconfig use
*/
- FcFontSet* pOrig = FcConfigGetFonts( getDefConfig(), eSetName );
+ FcFontSet* pOrig = FcConfigGetFonts( FcConfigGetCurrent(), eSetName );
if( !pOrig )
return;
@@ -914,13 +910,13 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
addtopattern(rWrapper, pPattern, eItalic, eWeight, eWidth, ePitch);
// query fontconfig for a substitute
- rWrapper.FcConfigSubstitute( rWrapper.getDefConfig(), pPattern, FcMatchPattern );
+ rWrapper.FcConfigSubstitute( rWrapper.FcConfigGetCurrent(), pPattern, FcMatchPattern );
rWrapper.FcDefaultSubstitute( pPattern );
// process the result of the fontconfig query
FcResult eResult = FcResultNoMatch;
FcFontSet* pFontSet = rWrapper.getFontSet();
- FcPattern* pResult = rWrapper.FcFontSetMatch( rWrapper.getDefConfig(), &pFontSet, 1, pPattern, &eResult );
+ FcPattern* pResult = rWrapper.FcFontSetMatch( rWrapper.FcConfigGetCurrent(), &pFontSet, 1, pPattern, &eResult );
rWrapper.FcPatternDestroy( pPattern );
FcFontSet* pSet = NULL;
@@ -982,7 +978,7 @@ bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star
if( ! rWrapper.isValid() )
return false;
- FcConfig* pConfig = rWrapper.getDefConfig();
+ FcConfig* pConfig = rWrapper.FcConfigGetCurrent();
FcPattern* pPattern = rWrapper.FcPatternCreate();
OString aLangAttrib;
diff --git a/psprint/source/fontmanager/fontmanager.cxx b/psprint/source/fontmanager/fontmanager.cxx
index a8c22f96e8d0..e794eabf42cb 100644
--- a/psprint/source/fontmanager/fontmanager.cxx
+++ b/psprint/source/fontmanager/fontmanager.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fontmanager.cxx,v $
- * $Revision: 1.81 $
+ * $Revision: 1.81.22.2 $
*
* This file is part of OpenOffice.org.
*
@@ -2089,6 +2089,20 @@ void PrintFontManager::initFontsAlias()
}
}
+// code stolen from vcl's RegisterFontSubstitutors()
+// TODO: use that method once psprint gets merged into vcl
+static bool AreFCSubstitutionsEnabled()
+{
+ bool bDisableFC = false;
+#ifdef SOLARIS
+ bDisableFC = true;
+#endif
+ const char* pEnvStr = ::getenv( "SAL_DISABLE_FC_SUBST" );
+ if( pEnvStr )
+ bDisableFC = (*pEnvStr == '\0') || (*pEnvStr != '0');
+ return bDisableFC;
+}
+
void PrintFontManager::initialize( void* pInitDisplay )
{
#ifdef CALLGRIND_COMPILE
@@ -2149,13 +2163,18 @@ void PrintFontManager::initialize( void* pInitDisplay )
if( rSalPrivatePath.getLength() )
{
OString aPath = rtl::OUStringToOString( rSalPrivatePath, aEncoding );
+ const bool bAreFCSubstitutionsEnabled = AreFCSubstitutionsEnabled();
sal_Int32 nIndex = 0;
do
{
OString aToken = aPath.getToken( 0, ';', nIndex );
normPath( aToken );
- if( !addFontconfigDir( aToken ) )
- continue;
+ // if registering an app-specific fontdir with fontconfig fails
+ // and fontconfig-based substitutions are enabled
+ // then trying to use these app-specific fonts doesn't make sense
+ if( m_bFontconfigSuccess && !addFontconfigDir( aToken ) )
+ if( bAreFCSubstitutionsEnabled )
+ continue;
m_aFontDirectories.push_back( aToken );
m_aPrivateFontDirectories.push_back( getDirectoryAtom( aToken, true ) );
} while( nIndex >= 0 );