Verify that every font pattern loaded from cache has both FC_FILE and

FC_FAMILY entries. Attempt to fix bug #2219.
This commit is contained in:
Keith Packard 2005-01-04 21:54:50 +00:00
parent d53461812d
commit fce87a189b
2 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2005-01-04 Keith Packard <keithp@keithp.com>
* 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 <keithp@keithp.com> 2004-12-29 Keith Packard <keithp@keithp.com>
* README: * README:

View File

@ -294,10 +294,18 @@ FcCacheFontSetAdd (FcFontSet *set,
font = FcNameParse (name); font = FcNameParse (name);
if (font) if (font)
{ {
FcChar8 *family;
if (FcDebug () & FC_DBG_CACHEV) if (FcDebug () & FC_DBG_CACHEV)
printf (" dir cache file \"%s\"\n", file); printf (" dir cache file \"%s\"\n", file);
ret = FcPatternAddString (font, FC_FILE, path); 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); frozen = FcPatternFreeze (font);
ret = (frozen != 0); ret = (frozen != 0);