[Libreoffice-commits] core.git: include/sal vcl/unx
Stephan Bergmann
sbergman at redhat.com
Tue May 22 06:33:00 UTC 2018
include/sal/log-areas.dox | 1
vcl/unx/generic/fontmanager/fontconfig.cxx | 66 ++++++++++------------------
vcl/unx/generic/fontmanager/fontmanager.cxx | 4 -
3 files changed, 26 insertions(+), 45 deletions(-)
New commits:
commit d9cc5a1c28a98bc2d4014a14a8e931662e94e037
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri May 18 12:08:25 2018 +0200
Turn debug fprint in vcl/unx/generic/fontmanager/ into SAL_INFO
...mapping OSL_DEBUG_LEVEL > 1 ones to "vcl.fonts" and OSL_DEBUG_LEVEL > 2 ones
to new "vcl.fonts.detail"
Change-Id: I750b4915083c4a0f9d0310a667987ff33d7fcc2a
Reviewed-on: https://gerrit.libreoffice.org/54526
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 860e23040141..8819bef136e0 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -461,6 +461,7 @@ certain functionality.
@li @c vcl.eventtesting
@li @c vcl.filter
@li @c vcl.fonts - font-specific code
+ at li @c vcl.fonts.detail
@li @c vcl.gdi - the GDI part of VCL, devices, bitmaps, etc.
@li @c vcl.gdi.wndproc - Windows Procedure part of VCL
@li @c vcl.gdi.fontmetric
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;
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx
index fc19a52b9022..390158e48cf8 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -243,9 +243,7 @@ std::vector<std::unique_ptr<PrintFontManager::PrintFont>> PrintFontManager::anal
int nLength = CountTTCFonts( aFullPath.getStr() );
if (nLength > 0)
{
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "ttc: %s contains %d fonts\n", aFullPath.getStr(), nLength );
-#endif
+ SAL_INFO("vcl.fonts", "ttc: " << aFullPath << " contains " << nLength << " fonts");
sal_uInt64 fileSize = 0;
More information about the Libreoffice-commits
mailing list