summaryrefslogtreecommitdiff
path: root/vcl/unx/generic/fontmanager/fontconfig.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx/generic/fontmanager/fontconfig.cxx')
-rw-r--r--vcl/unx/generic/fontmanager/fontconfig.cxx66
1 files changed, 24 insertions, 42 deletions
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index e70cb6d067af..17629c09173a 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -470,18 +470,14 @@ static void lcl_FcFontSetRemove(FcFontSet* pFSet, int i)
void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o_rVisitedPaths )
{
-#if OSL_DEBUG_LEVEL > 1
int nFonts = 0;
-#endif
FontCfgWrapper& rWrapper = FontCfgWrapper::get();
FcFontSet* pFSet = rWrapper.getFontSet();
const bool bMinimalFontset = utl::ConfigManager::IsFuzzing();
if( pFSet )
{
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "found %d entries in fontconfig fontset\n", pFSet->nfont );
-#endif
+ SAL_INFO("vcl.fonts", "found " << pFSet->nfont << " entries in fontconfig fontset");
for( int i = 0; i < pFSet->nfont; i++ )
{
FcChar8* file = nullptr;
@@ -511,20 +507,17 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o
if( eFileRes != FcResultMatch || eFamilyRes != FcResultMatch || eOutRes != FcResultMatch )
continue;
-#if (OSL_DEBUG_LEVEL > 2)
- fprintf( stderr, "found font \"%s\" in file %s\n"
- " weight = %d, slant = %d, style = \"%s\"\n"
- " width = %d, spacing = %d, outline = %d, format %s\n"
- , family, file
- , eWeightRes == FcResultMatch ? weight : -1
- , eSpacRes == FcResultMatch ? slant : -1
- , eStyleRes == FcResultMatch ? (const char*) style : "<nil>"
- , eWeightRes == FcResultMatch ? width : -1
- , eSpacRes == FcResultMatch ? spacing : -1
- , eOutRes == FcResultMatch ? outline : -1
- , eFormatRes == FcResultMatch ? (const char*)format : "<unknown>"
- );
-#endif
+ SAL_INFO(
+ "vcl.fonts.detail",
+ "found font \"" << family << "\" in file " << file << ", weight = "
+ << (eWeightRes == FcResultMatch ? weight : -1) << ", slant = "
+ << (eSpacRes == FcResultMatch ? slant : -1) << ", style = \""
+ << (eStyleRes == FcResultMatch ? reinterpret_cast<const char*>(style) : "<nil>")
+ << "\", width = " << (eWeightRes == FcResultMatch ? width : -1) << ", spacing = "
+ << (eSpacRes == FcResultMatch ? spacing : -1) << ", outline = "
+ << (eOutRes == FcResultMatch ? outline : -1) << ", format "
+ << (eFormatRes == FcResultMatch
+ ? reinterpret_cast<const char*>(format) : "<unknown>"));
// OSL_ASSERT(eOutRes != FcResultMatch || outline);
@@ -534,9 +527,7 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o
if (isPreviouslyDuplicateOrObsoleted(pFSet, i))
{
-#if OSL_DEBUG_LEVEL > 2
- fprintf(stderr, "Ditching %s as duplicate/obsolete\n", file);
-#endif
+ SAL_INFO("vcl.fonts.detail", "Ditching " << file << " as duplicate/obsolete");
continue;
}
@@ -548,9 +539,7 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o
o_rVisitedPaths[aDir] = 1;
int nDirID = getDirectoryAtom( aDir );
-#if OSL_DEBUG_LEVEL > 2
- fprintf( stderr, "file %s not cached\n", aBase.getStr() );
-#endif
+ SAL_INFO("vcl.fonts.detail", "file " << aBase << " not cached");
// not known, analyze font file to get attributes
// not described by fontconfig (e.g. alias names, PSName)
if (eFormatRes != FcResultMatch)
@@ -558,9 +547,8 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o
std::vector<std::unique_ptr<PrintFont>> aFonts = analyzeFontFile( nDirID, aBase, reinterpret_cast<char*>(format) );
if(aFonts.empty())
{
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "Warning: file \"%s\" is unusable to psprint\n", aOrgPath.getStr() );
-#endif
+ SAL_INFO(
+ "vcl.fonts", "Warning: file \"" << aOrgPath << "\" is unusable to psprint");
//remove font, reuse index
//we want to remove unusable fonts here, in case there is a usable font
//which duplicates the properties of the unusable one
@@ -600,15 +588,17 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o
// ran to the end of the list)
xUpdate->m_nCollectionEntry = nCollectionEntry;
}
-#if OSL_DEBUG_LEVEL > 1
else
{
- fprintf( stderr, "multiple fonts for file, but no index in fontconfig pattern ! (index res = %d collection entry = %d\nfile will not be used\n", eIndexRes, nCollectionEntry );
+ SAL_INFO(
+ "vcl.fonts",
+ "multiple fonts for file, but no index in fontconfig pattern ! (index res ="
+ << eIndexRes << " collection entry = " << nCollectionEntry
+ << "; file will not be used");
// we have found more than one font in this file
// but fontconfig will not tell us which index is meant
// -> something is in disorder, do not use this font
}
-#endif
}
if (xUpdate)
@@ -631,20 +621,14 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o
fontID aFont = m_nNextFontID++;
m_aFonts[ aFont ] = xUpdate.release();
m_aFontFileToFontID[ aBase ].insert( aFont );
-#if OSL_DEBUG_LEVEL > 1
nFonts++;
-#endif
-#if OSL_DEBUG_LEVEL > 2
- fprintf( stderr, "inserted font %s as fontID %d\n", family, aFont );
-#endif
+ SAL_INFO("vcl.fonts.detail", "inserted font " << family << " as fontID " << aFont);
}
}
}
// how does one get rid of the config ?
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "inserted %d fonts from fontconfig\n", nFonts );
-#endif
+ SAL_INFO("vcl.fonts", "inserted " << nFonts << " fonts from fontconfig");
}
void PrintFontManager::deinitFontconfig()
@@ -657,9 +641,7 @@ void PrintFontManager::addFontconfigDir( const OString& rDirName )
const char* pDirName = rDirName.getStr();
bool bDirOk = (FcConfigAppFontAddDir(FcConfigGetCurrent(), reinterpret_cast<FcChar8 const *>(pDirName) ) == FcTrue);
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "FcConfigAppFontAddDir( \"%s\") => %d\n", pDirName, bDirOk );
-#endif
+ SAL_INFO("vcl.fonts", "FcConfigAppFontAddDir( \"" << pDirName << "\") => " << bDirOk);
if( !bDirOk )
return;