summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-02-20 12:06:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-02-20 12:20:59 +0000
commit65a3ec97b5032d1748c8f84eeb0b8656e1c25918 (patch)
tree419970ef7e476f3353f1ca3140f14d037f931551
parent1be196c7fbf59fd811f19505f4691b979b6d4bdb (diff)
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
-rw-r--r--vcl/generic/fontmanager/fontconfig.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx
index 4fd5d9e7406e..db538461f823 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -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;
}