Kaydet (Commit) 65a3ec97 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resoves fdo#42901 duplicated .pfb without duplicated .afm drops font

If we have a duplicate font entry the duplicate is dropped, but
if the first font was invalid, e.g. .pfb without .afm this results
in dropping *both* fonts, the valid and invalid one
üst 1be196c7
......@@ -466,6 +466,19 @@ namespace
}
}
//FontConfig doesn't come with a way to remove an element from a FontSet as far
//as I can see
static void lcl_FcFontSetRemove(FcFontSet* pFSet, int i)
{
FcPatternDestroy(pFSet->fonts[i]);
int nTail = pFSet->nfont - (i + 1);
--pFSet->nfont;
if (!nTail)
return;
memmove(pFSet->fonts + i, pFSet->fonts + i + 1, nTail*sizeof(FcPattern*));
}
int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, int, rtl::OStringHash>& o_rVisitedPaths )
{
int nFonts = 0;
......@@ -557,7 +570,13 @@ int PrintFontManager::countFontconfigFonts( boost::unordered_map<rtl::OString, i
}
if( aFonts.empty() )
{
// TODO: remove fonts unusable to psprint from fontset
//remove font, reuse index
//we want to remove unusable fonts here, in case there is a usable font
//which duplicates the properties of the unusable one
//
//not removing the unusable font will risk the usable font being rejected
//as a duplicate by isPreviouslyDuplicateOrObsoleted
lcl_FcFontSetRemove(pFSet, i--);
continue;
}
......
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