[Libreoffice-commits] .: Branch 'libreoffice-3-5' - vcl/generic

Stephan Bergmann sbergmann at kemper.freedesktop.org
Tue Feb 28 01:00:20 PST 2012


 vcl/generic/fontmanager/fontconfig.cxx |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 2f0396695b24874a2883560d206dff4dcf7a6f4d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Feb 20 12:06:52 2012 +0000

    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 at redhat.com>

diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx
index a120fb7..201cfa3 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;
             }
 


More information about the Libreoffice-commits mailing list