vcl/quartz/ctfonts.cxx | 14 ++++++++++++++ vcl/unx/generic/fontmanager/fontconfig.cxx | 12 ++++++++++++ vcl/win/gdi/salfont.cxx | 9 +++++++++ 3 files changed, 35 insertions(+)
New commits: commit 48304cb5b4d8df71463837e2e48aa7c4d9594df9 Author: Khaled Hosny <khaledho...@eglug.org> Date: Tue Oct 25 02:25:08 2016 +0200 Skip font formats not supported by CommonSalLayout Donât list fonts we canât handle, bad things would happen⦠Change-Id: Ic88486e34da69090deb3e8c394cb75a8e4e5cbd0 diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index ac17abc..948bfb5 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -341,6 +341,20 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont // get font attributes CFDictionaryRef pAttrDict = static_cast<CFDictionaryRef>(CTFontDescriptorCopyAttribute( pFD, kCTFontTraitsAttribute )); + if (bFontEnabled && *bFontEnabled && SalLayout::UseCommonLayout()) + { + // Ignore font formats not supported by CommonSalLayout. + int nFormat; + CFNumberRef pFormat = static_cast<CFNumberRef>(CTFontDescriptorCopyAttribute(pFD, kCTFontFormatAttribute)); + CFNumberGetValue(pFormat, kCFNumberIntType, &nFormat); + if (nFormat == kCTFontFormatUnrecognized || nFormat == kCTFontFormatPostScript || nFormat == kCTFontFormatBitmap) + { + SAL_INFO("vcl.fonts", "Ignoring font with unsupported format: " << rDFA.GetFamilyName()); + *bFontEnabled = false; + } + CFRelease(pFormat); + } + // get symbolic trait // TODO: use other traits such as MonoSpace/Condensed/Expanded or Vertical too SInt64 nSymbolTrait = 0; diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index cbdbd33..a8731401 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -25,6 +25,7 @@ #include <vcl/vclenum.hxx> #include <vcl/wrkwin.hxx> #include "fontinstance.hxx" +#include "sallayout.hxx" #include <i18nlangtag/languagetag.hxx> #include <i18nutil/unicode.hxx> #include <rtl/strbuf.hxx> @@ -119,6 +120,17 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName ) FcResult eOutRes = FcPatternGetBool( pPattern, FC_OUTLINE, 0, &bOutline ); if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) ) continue; + if (SalLayout::UseCommonLayout()) + { + // Ignore Type 1 fonts; CommonSalLayout does not support them. + FcChar8* pFormat = nullptr; + FcResult eFormatRes = FcPatternGetString(pPattern, FC_FONTFORMAT, 0, &pFormat); + if ((eFormatRes == FcResultMatch) && + (strcmp(reinterpret_cast<char*>(pFormat), "Type 1") == 0)) + { + continue; + } + } FcPatternReference( pPattern ); FcFontSetAdd( m_pOutlineSet, pPattern ); } diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index 956459b..7f11d65 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -1532,6 +1532,15 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe, if( (nFontType & RASTER_FONTTYPE) && !(nFontType & DEVICE_FONTTYPE) ) return 1; + // Ignore font formats not supported by CommonSalLayout. + if (SalLayout::UseCommonLayout()) + if ((nFontType & RASTER_FONTTYPE)) + { + SAL_INFO("vcl.fonts", "Ignoring font with unsupported format: " + << OUString(reinterpret_cast<const sal_Unicode*>(pLogFont->elfLogFont.lfFaceName))); + return 1; + } + WinFontFace* pData = ImplLogMetricToDevFontDataW( pLogFont, &(pMetric->ntmTm), nFontType ); pData->SetFontId( sal_IntPtr( pInfo->mnFontCount++ ) );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits