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 @@
    // 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 @@
        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 @@
            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++ ) );