diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-05-18 12:08:25 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-05-22 08:32:37 +0200 |
commit | d9cc5a1c28a98bc2d4014a14a8e931662e94e037 (patch) | |
tree | 855494adad1e59d25d628c0113e3ef09bd8dbf20 /vcl | |
parent | c697e7f566302d5d52c3a043d5bddd8cf65499a1 (diff) |
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@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/generic/fontmanager/fontconfig.cxx | 66 | ||||
-rw-r--r-- | vcl/unx/generic/fontmanager/fontmanager.cxx | 4 |
2 files changed, 25 insertions, 45 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; 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; |