tdf#140881: Ignore WOFF/WOFF2 fonts with FontConfig
FC_FONT_WRAPPER requires unreleased FontConfig, but lets have this in so
it works when FontConfig have it.
Change-Id: I8f48ac1f68a3af6e1853e9eb1925d382b57136c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156049
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 1131714..ae190ab 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -187,6 +187,10 @@ FontCfgWrapper::FontCfgWrapper()
FcInit();
}
#ifndef FC_FONT_WRAPPER
#define FC_FONT_WRAPPER "fontwrapper"
#endif
void FontCfgWrapper::addFontSet( FcSetName eSetName )
{
// Add only acceptable fonts to our config, for future fontconfig use.
@@ -212,6 +216,12 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
if ((eFormatRes == FcResultMatch) && (strcmp(reinterpret_cast<char*>(pFormat), "Type 1") == 0))
continue;
// Ignore any other non-SFNT wrapper format, including WOFF and WOFF2, too.
FcChar8* pWrapper = nullptr;
FcResult eWrapperRes = FcPatternGetString(pPattern, FC_FONT_WRAPPER, 0, &pWrapper);
if ((eWrapperRes == FcResultMatch) && (strcmp(reinterpret_cast<char*>(pWrapper), "SFNT") != 0))
continue;
FcPatternReference( pPattern );
FcFontSetAdd( m_pFontSet, pPattern );
}