From fce87a189b2e89a07e271ff7f1e3dab0d4b5b919 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 4 Jan 2005 21:54:50 +0000 Subject: [PATCH] Verify that every font pattern loaded from cache has both FC_FILE and FC_FAMILY entries. Attempt to fix bug #2219. --- ChangeLog | 7 +++++++ src/fccache.c | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fbe4adb..729c941 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-01-04 Keith Packard + + * src/fccache.c: (FcCacheFontSetAdd): + Verify that every font pattern loaded from cache has + both FC_FILE and FC_FAMILY entries. + Attempt to fix bug #2219. + 2004-12-29 Keith Packard * README: diff --git a/src/fccache.c b/src/fccache.c index 9e47e86..2845543 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -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);