diff --git a/0001-Resolves-rhbz-715549-use-fontconfig-s-detected-forma.patch b/0001-Resolves-rhbz-715549-use-fontconfig-s-detected-forma.patch new file mode 100644 index 0000000..6e4c747 --- /dev/null +++ b/0001-Resolves-rhbz-715549-use-fontconfig-s-detected-forma.patch @@ -0,0 +1,213 @@ +From 4d974b37e75d1c46b9ddbf86bc6f2756014c7c46 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Tue, 19 Jul 2011 13:39:34 +0100 +Subject: [PATCH] Resolves: rhbz#715549 use fontconfig's detected format when + available + +--- + vcl/inc/vcl/fontmanager.hxx | 2 +- + vcl/unx/generic/fontmanager/fontconfig.cxx | 12 +++- + vcl/unx/generic/fontmanager/fontmanager.cxx | 81 +++++++++++++++++---------- + 3 files changed, 62 insertions(+), 33 deletions(-) + +diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx +index 410ecf1..816adbe 100644 +--- a/vcl/inc/vcl/fontmanager.hxx ++++ b/vcl/inc/vcl/fontmanager.hxx +@@ -333,7 +333,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager + + void getFontAttributesFromXLFD( PrintFont* pFont, const std::list< rtl::OString >& rXLFDs ) const; + +- bool analyzeFontFile( int nDirID, const rtl::OString& rFileName, const std::list< rtl::OString >& rXLFDs, std::list< PrintFont* >& rNewFonts ) const; ++ bool analyzeFontFile( int nDirID, const rtl::OString& rFileName, const std::list< rtl::OString >& rXLFDs, std::list< PrintFont* >& rNewFonts, const char *pFormat=NULL ) const; + rtl::OUString convertTrueTypeName( void* pNameRecord ) const; // actually a NameRecord* formt font subsetting code + void analyzeTrueTypeFamilyName( void* pTTFont, std::list< rtl::OUString >& rnames ) const; // actually a TrueTypeFont* from font subsetting code + bool analyzeTrueTypeFile( PrintFont* pFont ) const; +diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx +index e4b2f00..5e97bec 100644 +--- a/vcl/unx/generic/fontmanager/fontconfig.cxx ++++ b/vcl/unx/generic/fontmanager/fontconfig.cxx +@@ -68,6 +68,9 @@ using namespace psp; + #ifndef FC_EMBOLDEN + #define FC_EMBOLDEN "embolden" + #endif ++#ifndef FC_FONTFORMAT ++ #define FC_FONTFORMAT "fontformat" ++#endif + + #include + #include +@@ -467,6 +470,7 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_mapfonts[i], FC_SPACING, 0, &spacing); + FcResult eOutRes = FcPatternGetBool(pFSet->fonts[i], FC_OUTLINE, 0, &outline); + FcResult eIndexRes = FcPatternGetInteger(pFSet->fonts[i], FC_INDEX, 0, &nCollectionEntry); ++ FcResult eFormatRes = FcPatternGetString(pFSet->fonts[i], FC_FONTFORMAT, 0, &format); + + if( eFileRes != FcResultMatch || eFamilyRes != FcResultMatch || eOutRes != FcResultMatch ) + continue; +@@ -488,13 +493,14 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map 2) + fprintf( stderr, "found font \"%s\" in file %s\n" + " weight = %d, slant = %d, style = \"%s\"\n" +- " spacing = %d, outline = %d\n" ++ " spacing = %d, outline = %d, format %s\n" + , family, file + , eWeightRes == FcResultMatch ? weight : -1 + , eSpacRes == FcResultMatch ? slant : -1 + , eStyleRes == FcResultMatch ? (const char*) style : "" + , eSpacRes == FcResultMatch ? spacing : -1 + , eOutRes == FcResultMatch ? outline : -1 ++ , eFormatRes == FcResultMatch ? (const char*)format : "" + ); + #endif + +@@ -529,7 +535,9 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map aDummy; +- analyzeFontFile( nDirID, aBase, aDummy, aFonts ); ++ if (eFormatRes != FcResultMatch) ++ format = NULL; ++ analyzeFontFile( nDirID, aBase, aDummy, aFonts, (const char*)format ); + #if OSL_DEBUG_LEVEL > 1 + if( aFonts.empty() ) + fprintf( stderr, "Warning: file \"%s\" is unusable to psprint\n", aOrgPath.getStr() ); +diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx +index 2dceb35..27a2629 100644 +--- a/vcl/unx/generic/fontmanager/fontmanager.cxx ++++ b/vcl/unx/generic/fontmanager/fontmanager.cxx +@@ -1281,9 +1281,12 @@ int PrintFontManager::addFontFile( const ::rtl::OString& rFileName, int /*nFaceN + return nFontId; + } + +-// ------------------------------------------------------------------------- ++enum fontFormat ++{ ++ UNKNOWN, TRUETYPE, CFF, TYPE1, AFM ++}; + +-bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, const ::std::list& rXLFDs, ::std::list< PrintFontManager::PrintFont* >& rNewFonts ) const ++bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, const ::std::list& rXLFDs, ::std::list< PrintFontManager::PrintFont* >& rNewFonts, const char *pFormat ) const + { + rNewFonts.clear(); + +@@ -1297,8 +1300,32 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co + if( access( aFullPath.getStr(), R_OK ) ) + return false; + +- ByteString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); +- if( aExt.EqualsIgnoreCaseAscii( "pfb" ) || aExt.EqualsIgnoreCaseAscii( "pfa" ) ) ++ fontFormat eFormat = UNKNOWN; ++ if (pFormat) ++ { ++ if (!strcmp(pFormat, "TrueType")) ++ eFormat = TRUETYPE; ++ else if (!strcmp(pFormat, "CFF")) ++ eFormat = CFF; ++ else if (!strcmp(pFormat, "Type 1")) ++ eFormat = TYPE1; ++ } ++ if (eFormat == UNKNOWN) ++ { ++ ByteString aExt( rFontFile.copy( rFontFile.lastIndexOf( '.' )+1 ) ); ++ if( aExt.EqualsIgnoreCaseAscii( "pfb" ) || aExt.EqualsIgnoreCaseAscii( "pfa" ) ) ++ eFormat = TYPE1; ++ else if( aExt.EqualsIgnoreCaseAscii( "afm" ) ) ++ eFormat = AFM; ++ else if( aExt.EqualsIgnoreCaseAscii( "ttf" ) ++ || aExt.EqualsIgnoreCaseAscii( "ttc" ) ++ || aExt.EqualsIgnoreCaseAscii( "tte" ) ) // #i33947# for Gaiji support ++ eFormat = TRUETYPE; ++ else if( aExt.EqualsIgnoreCaseAscii( "otf" ) ) // check for TTF- and PS-OpenType too ++ eFormat = CFF; ++ } ++ ++ if (eFormat == TYPE1) + { + // check for corresponding afm metric + // first look for an adjacent file +@@ -1352,7 +1379,7 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co + } + } + } +- else if( aExt.EqualsIgnoreCaseAscii( "afm" ) ) ++ else if (eFormat == AFM) + { + ByteString aFilePath( aDir ); + aFilePath.Append( '/' ); +@@ -1365,34 +1392,14 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co + else + delete pFont; + } +- else if( aExt.EqualsIgnoreCaseAscii( "ttf" ) +- || aExt.EqualsIgnoreCaseAscii( "tte" ) // #i33947# for Gaiji support +- || aExt.EqualsIgnoreCaseAscii( "otf" ) ) // check for TTF- and PS-OpenType too +- { +- TrueTypeFontFile* pFont = new TrueTypeFontFile(); +- pFont->m_nDirectory = nDirID; +- pFont->m_aFontFile = rFontFile; +- pFont->m_nCollectionEntry = -1; +- +- if( rXLFDs.size() ) +- getFontAttributesFromXLFD( pFont, rXLFDs ); +- // need to read the font anyway to get aliases inside the font file +- if( ! analyzeTrueTypeFile( pFont ) ) +- { +- delete pFont; +- pFont = NULL; +- } +- else +- rNewFonts.push_back( pFont ); +- } +- else if( aExt.EqualsIgnoreCaseAscii( "ttc" ) ) ++ else if (eFormat == TRUETYPE || eFormat == CFF) + { + // get number of ttc entries + int nLength = CountTTCFonts( aFullPath.getStr() ); + if( nLength ) + { + #if OSL_DEBUG_LEVEL > 1 +- fprintf( stderr, "%s contains %d fonts\n", aFullPath.getStr(), nLength ); ++ fprintf( stderr, "ttc: %s contains %d fonts\n", aFullPath.getStr(), nLength ); + #endif + for( int i = 0; i < nLength; i++ ) + { +@@ -1411,10 +1418,24 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, co + rNewFonts.push_back( pFont ); + } + } +-#if OSL_DEBUG_LEVEL > 1 + else +- fprintf( stderr, "CountTTCFonts( \"%s/%s\" ) failed\n", getDirectory(nDirID).getStr(), rFontFile.getStr() ); +-#endif ++ { ++ TrueTypeFontFile* pFont = new TrueTypeFontFile(); ++ pFont->m_nDirectory = nDirID; ++ pFont->m_aFontFile = rFontFile; ++ pFont->m_nCollectionEntry = -1; ++ ++ if( rXLFDs.size() ) ++ getFontAttributesFromXLFD( pFont, rXLFDs ); ++ // need to read the font anyway to get aliases inside the font file ++ if( ! analyzeTrueTypeFile( pFont ) ) ++ { ++ delete pFont; ++ pFont = NULL; ++ } ++ else ++ rNewFonts.push_back( pFont ); ++ } + } + return ! rNewFonts.empty(); + } +-- +1.7.6 + diff --git a/libreoffice.spec b/libreoffice.spec index 0e10311..d82a0b8 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -115,6 +115,7 @@ Patch20: 0001-Related-rhbz-711087-band-aid.patch Patch21: 0001-rhbz-667082-do-not-crash-importing-section-containin.patch Patch22: 0001-Related-rhbz-718976-crash-in-SwTxtSizeInfo-GetMultiC.patch Patch23: libreoffice-poppler-0.17.0.patch +Patch24: 0001-Resolves-rhbz-715549-use-fontconfig-s-detected-forma.patch %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %define instdir %{_libdir} @@ -740,6 +741,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc %patch21 -p1 -b .rhbz667082-do-not-crash-importing-section-containin.patch %patch22 -p1 -b .rhbz718976-crash-in-SwTxtSizeInfo-GetMultiC.patch %patch23 -p1 -b .poppler-0.17.0.patch +%patch24 -p1 -b .rhbz-715549-use-fontconfig-s-detected-forma.patch # these are horribly incomplete--empty translations and copied english # strings with spattering of translated strings @@ -2024,6 +2026,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %{basisinstdir}/program/kde-open-url %changelog +* Tue Jul 19 2011 Caolán McNamara - 3.4.2.1-3 +- Resolves: rhbz#715549 use fontconfig's detected format + * Mon Jul 18 2011 Caolán McNamara - 3.4.2.1-2 - Rebuild (poppler-0.17.0), add libreoffice-poppler-0.17.0.patch seeing as the API changed for some reason or other