]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcfreetype.c
Skip bitmap fonts which can't even get it together enough to declare a
[fontconfig.git] / src / fcfreetype.c
index 8cdc647c2cd6fd419049ec3b4e94cd3246e933dc..9dc45fc3c347e395d5dea60855f6388eca3d7dc0 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;
@@ -1000,6 +1000,7 @@ FcFreeTypeQuery (const FcChar8    *file,
     FcChar8        *family = 0;
 #endif
     FcChar8        *complex;
+    FcChar8        *file2;
     const FcChar8   *foundry = 0;
     int                    spacing;
     TT_OS2         *os2;
@@ -1280,8 +1281,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));
 
@@ -1555,17 +1561,20 @@ FcFreeTypeQuery (const FcChar8  *file,
     }
 #endif
 
-#if 0
     /*
      * Skip over PCF fonts that have no encoded characters; they're
      * usually just Unicode fonts transcoded to some legacy encoding
+     * ftglue.c forces us to approximate whether a font is a PCF font
+     * or not by whether it has any BDF properties.  Try PIXEL_SIZE;
+     * I don't know how to get a list of BDF properties on the font. -PL
      */
     if (FcCharSetCount (cs) == 0)
     {
-       if (!strcmp(FT_MODULE_CLASS(&face->driver->root)->module_name, "pcf"))
+#if HAVE_FT_GET_BDF_PROPERTY
+       if(FT_Get_BDF_Property(face, "PIXEL_SIZE", &prop) == 0)
            goto bail2;
-    }
 #endif
+    }
 
     if (!FcPatternAddCharSet (pat, FC_CHARSET, cs))
        goto bail2;
@@ -1600,6 +1609,11 @@ FcFreeTypeQuery (const FcChar8   *file,
             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;