]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccache.c
Verify that every font pattern loaded from cache has both FC_FILE and
[fontconfig.git] / src / fccache.c
index 9e47e86121d7901604027141fa7fea1db14f61a4..28455430a62a2777e6cf12a8df1437622653359e 100644 (file)
@@ -294,10 +294,18 @@ FcCacheFontSetAdd (FcFontSet          *set,
        font = FcNameParse (name);
        if (font)
        {
+           FcChar8 *family;
+           
            if (FcDebug () & FC_DBG_CACHEV)
                printf (" dir cache file \"%s\"\n", file);
            ret = FcPatternAddString (font, FC_FILE, path);
-           if (ret && (!config || FcConfigAcceptFont (config, font)))
+           /*
+            * Make sure the pattern has the file name as well as
+            * already containing at least one family name.
+            */
+           if (ret && 
+               FcPatternGetString (font, FC_FAMILY, 0, &family) == FcResultMatch &&
+               (!config || FcConfigAcceptFont (config, font)))
            {
                frozen = FcPatternFreeze (font);
                ret = (frozen != 0);