]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcfreetype.c
Pass the buck; make fontconfig not crash on pango badness.
[fontconfig.git] / src / fcfreetype.c
index 0b976f70c85f763abb238fe876083ea702132e86..e3c5ef23168c1dae2e68c460e527a1d920d9c06a 100644 (file)
@@ -97,7 +97,7 @@ FcFreeTypeIsExclusiveLang (const FcChar8  *lang)
 
     for (i = 0; i < NUM_CODE_PAGE_RANGE; i++)
     {
-       if (FcLangCompare (lang, FcCodePageRange[i].lang) != FcLangDifferentLang)
+       if (FcLangCompare (lang, FcCodePageRange[i].lang) == FcLangEqual)
            return FcTrue;
     }
     return FcFalse;
@@ -976,7 +976,6 @@ FcStringInPatternElement (FcPattern *pat, const char *elt, FcChar8 *string)
        if (!FcStrCmpIgnoreBlanksAndCase (old, string))
        {
            return FcTrue;
-           break;
        }
     return FcFalse;
 }
@@ -1000,6 +999,7 @@ FcFreeTypeQuery (const FcChar8     *file,
     FcChar8        *family = 0;
 #endif
     FcChar8        *complex;
+    FcChar8        *file2;
     const FcChar8   *foundry = 0;
     int                    spacing;
     TT_OS2         *os2;
@@ -1280,8 +1280,13 @@ FcFreeTypeQuery (const FcChar8   *file,
                printf ("Saving unique fullname %s\n", full);
     }
 
-    if (!FcPatternAddString (pat, FC_FILE, (FcChar8 *)basename((char *)FcStrCopy(file))))
+    file2 = FcStrCopy (file);
+    if (!FcPatternAddString (pat, FC_FILE, (FcChar8 *)basename((char *)file2)))
+    {
+       FcStrFree (file2);
        goto bail1;
+    }
+    FcStrFree (file2);
 
     FcPatternAddFullFname (pat, (const char *)FcStrCopy (file));
 
@@ -1594,15 +1599,20 @@ FcFreeTypeQuery (const FcChar8  *file,
        for (i = 0; i < face->num_fixed_sizes; i++)
            if (!FcPatternAddDouble (pat, FC_PIXEL_SIZE,
                                     FcGetPixelSize (face, i)))
-               goto bail1;
+               goto bail2;
        if (!FcPatternAddBool (pat, FC_ANTIALIAS, FcFalse))
-           goto bail1;
+           goto bail2;
 #if HAVE_FT_GET_BDF_PROPERTY
         if(face->num_fixed_sizes == 1) {
             int rc;
             int value;
             BDF_PropertyRec prop;
 
+           /* skip bitmap fonts which do not even have a family name */
+           rc =  FT_Get_BDF_Property(face, "FAMILY_NAME", &prop);
+           if (rc != 0 || prop.type != BDF_PROPERTY_TYPE_ATOM)
+               goto bail2;
+
             rc = FT_Get_BDF_Property(face, "POINT_SIZE", &prop);
             if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_INTEGER)
                 value = prop.u.integer;
@@ -2302,6 +2312,10 @@ FcFreeTypeCharIndex (FT_Face face, FcChar32 ucs4)
     int                    p;
 
     initial = 0;
+
+    if (!face)
+        return 0;
+
     /*
      * Find the current encoding
      */
@@ -2422,7 +2436,7 @@ FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4,
 FcCharSet *
 FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing)
 {
-    FcChar32       page, off, max, ucs4;
+    FcChar32       page, off, ucs4;
 #ifdef CHECK
     FcChar32       font_max = 0;
 #endif
@@ -2503,7 +2517,6 @@ FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing)
        {
            FT_UInt gindex;
          
-           max = fcFontDecoders[o].max;
            /*
             * Find the first encoded character in the font
             */