diff options
author | Khaled Hosny <khaled@libreoffice.org> | 2023-08-24 10:49:42 +0000 |
---|---|---|
committer | خالد حسني <khaled@libreoffice.org> | 2023-08-24 22:22:17 +0200 |
commit | 5ca5acdd6e12fec08927743b60899100bc89af4d (patch) | |
tree | 03eda2e48139c405a724ac7679e2e14c49a55991 /vcl/unx | |
parent | 9b6f0bcb042354fd5c25f78e432b8983963e0e9c (diff) |
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>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/fontmanager/fontconfig.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index 113171445760..ae190ab96e58 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 ); } |