summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-02-20 12:06:52 +0000
committerStephan Bergmann <sbergman@redhat.com>2012-02-28 09:54:08 +0100
commit2f0396695b24874a2883560d206dff4dcf7a6f4d (patch)
treeccc1bfe95cd0a8210c99ec2466b69de64d21263a /vcl
parent018fd9afa4659a791dd6e2a6c1d44185505ba4ec (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 (cherry picked from commit 65a3ec97b5032d1748c8f84eeb0b8656e1c25918) Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-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 a120fb7ff221..201cfa3a8fd2 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -467,6 +467,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;
@@ -559,7 +572,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;
}