Kaydet (Commit) 48304cb5 authored tarafından Khaled Hosny's avatar Khaled Hosny

Skip font formats not supported by CommonSalLayout

Don’t list fonts we can’t handle, bad things would happen…

Change-Id: Ic88486e34da69090deb3e8c394cb75a8e4e5cbd0
üst 50cbc6fb
...@@ -341,6 +341,20 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont ...@@ -341,6 +341,20 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont
// get font attributes // get font attributes
CFDictionaryRef pAttrDict = static_cast<CFDictionaryRef>(CTFontDescriptorCopyAttribute( pFD, kCTFontTraitsAttribute )); 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 // get symbolic trait
// TODO: use other traits such as MonoSpace/Condensed/Expanded or Vertical too // TODO: use other traits such as MonoSpace/Condensed/Expanded or Vertical too
SInt64 nSymbolTrait = 0; SInt64 nSymbolTrait = 0;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <vcl/vclenum.hxx> #include <vcl/vclenum.hxx>
#include <vcl/wrkwin.hxx> #include <vcl/wrkwin.hxx>
#include "fontinstance.hxx" #include "fontinstance.hxx"
#include "sallayout.hxx"
#include <i18nlangtag/languagetag.hxx> #include <i18nlangtag/languagetag.hxx>
#include <i18nutil/unicode.hxx> #include <i18nutil/unicode.hxx>
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
...@@ -119,6 +120,17 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName ) ...@@ -119,6 +120,17 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
FcResult eOutRes = FcPatternGetBool( pPattern, FC_OUTLINE, 0, &bOutline ); FcResult eOutRes = FcPatternGetBool( pPattern, FC_OUTLINE, 0, &bOutline );
if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) ) if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) )
continue; 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 ); FcPatternReference( pPattern );
FcFontSetAdd( m_pOutlineSet, pPattern ); FcFontSetAdd( m_pOutlineSet, pPattern );
} }
......
...@@ -1532,6 +1532,15 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe, ...@@ -1532,6 +1532,15 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
if( (nFontType & RASTER_FONTTYPE) && !(nFontType & DEVICE_FONTTYPE) ) if( (nFontType & RASTER_FONTTYPE) && !(nFontType & DEVICE_FONTTYPE) )
return 1; 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 ); WinFontFace* pData = ImplLogMetricToDevFontDataW( pLogFont, &(pMetric->ntmTm), nFontType );
pData->SetFontId( sal_IntPtr( pInfo->mnFontCount++ ) ); pData->SetFontId( sal_IntPtr( pInfo->mnFontCount++ ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment