2 * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.7 2002/05/29 08:21:33 keithp Exp $
4 * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of Keith Packard not be used in
11 * advertising or publicity pertaining to distribution of the software without
12 * specific, written prior permission. Keith Packard makes no
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
16 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
35 config
= malloc (sizeof (FcConfig
));
38 FcMemAlloc (FC_MEM_CONFIG
, sizeof (FcConfig
));
40 config
->configDirs
= FcStrSetCreate ();
41 if (!config
->configDirs
)
44 config
->configFiles
= FcStrSetCreate ();
45 if (!config
->configFiles
)
48 config
->fontDirs
= FcStrSetCreate ();
49 if (!config
->fontDirs
)
53 if (!FcConfigSetCache (config
, (FcChar8
*) ("~/" FC_USER_CACHE_FILE
)))
58 config
->substPattern
= 0;
59 config
->substFont
= 0;
60 config
->maxObjects
= 0;
61 for (set
= FcSetSystem
; set
<= FcSetApplication
; set
++)
62 config
->fonts
[set
] = 0;
64 config
->rescanTime
= time(0);
65 config
->rescanInterval
= 30;
70 FcStrSetDestroy (config
->fontDirs
);
72 FcStrSetDestroy (config
->configFiles
);
74 FcStrSetDestroy (config
->configDirs
);
77 FcMemFree (FC_MEM_CONFIG
, sizeof (FcConfig
));
83 FcConfigNewestFile (FcStrSet
*files
)
85 FcStrList
*list
= FcStrListCreate (files
);
93 while ((file
= FcStrListNext (list
)))
95 if (stat ((char *) file
, &statb
) == 0)
98 newest
= statb
.st_mtime
;
99 else if (statb
.st_mtime
- newest
> 0)
100 newest
= statb
.st_mtime
;
103 FcStrListDone (list
);
109 FcConfigUptoDate (FcConfig
*config
)
113 time_t now
= time(0);
116 config
= FcConfigGetCurrent ();
120 config_time
= FcConfigNewestFile (config
->configFiles
);
121 font_time
= FcConfigNewestFile (config
->configDirs
);
122 if (config_time
- config
->rescanTime
> 0 ||
123 font_time
- config
->rescanTime
> 0)
127 config
->rescanTime
= now
;
132 FcSubstDestroy (FcSubst
*s
)
139 FcTestDestroy (s
->test
);
140 FcEditDestroy (s
->edit
);
146 FcConfigDestroy (FcConfig
*config
)
150 if (config
== _fcConfig
)
153 FcStrSetDestroy (config
->configDirs
);
154 FcStrSetDestroy (config
->fontDirs
);
155 FcStrSetDestroy (config
->configFiles
);
157 FcStrFree (config
->cache
);
159 FcSubstDestroy (config
->substPattern
);
160 FcSubstDestroy (config
->substFont
);
161 for (set
= FcSetSystem
; set
<= FcSetApplication
; set
++)
162 if (config
->fonts
[set
])
163 FcFontSetDestroy (config
->fonts
[set
]);
165 FcMemFree (FC_MEM_CONFIG
, sizeof (FcConfig
));
169 * Scan the current list of directories in the configuration
170 * and build the set of available fonts. Update the
171 * per-user cache file to reflect the new configuration
175 FcConfigBuildFonts (FcConfig
*config
)
182 fonts
= FcFontSetCreate ();
186 cache
= FcFileCacheCreate ();
190 FcFileCacheLoad (cache
, config
->cache
);
192 list
= FcConfigGetFontDirs (config
);
196 while ((dir
= FcStrListNext (list
)))
198 if (FcDebug () & FC_DBG_FONTSET
)
199 printf ("scan dir %s\n", dir
);
200 FcDirScan (fonts
, config
->fontDirs
, cache
, config
->blanks
, dir
, FcFalse
);
203 FcStrListDone (list
);
205 if (FcDebug () & FC_DBG_FONTSET
)
206 FcFontSetPrint (fonts
);
208 FcFileCacheSave (cache
, config
->cache
);
209 FcFileCacheDestroy (cache
);
211 FcConfigSetFonts (config
, fonts
, FcSetSystem
);
215 FcFontSetDestroy (fonts
);
221 FcConfigSetCurrent (FcConfig
*config
)
224 if (!FcConfigBuildFonts (config
))
228 FcConfigDestroy (_fcConfig
);
234 FcConfigGetCurrent (void)
243 FcConfigAddConfigDir (FcConfig
*config
,
246 return FcStrSetAddFilename (config
->configDirs
, d
);
250 FcConfigGetConfigDirs (FcConfig
*config
)
254 config
= FcConfigGetCurrent ();
258 return FcStrListCreate (config
->configDirs
);
262 FcConfigAddFontDir (FcConfig
*config
,
265 return FcStrSetAddFilename (config
->fontDirs
, d
);
269 FcConfigAddDir (FcConfig
*config
,
272 return (FcConfigAddConfigDir (config
, d
) &&
273 FcConfigAddFontDir (config
, d
));
277 FcConfigGetFontDirs (FcConfig
*config
)
281 config
= FcConfigGetCurrent ();
285 return FcStrListCreate (config
->fontDirs
);
289 FcConfigAddConfigFile (FcConfig
*config
,
293 FcChar8
*file
= FcConfigFilename (f
);
298 ret
= FcStrSetAdd (config
->configFiles
, file
);
304 FcConfigGetConfigFiles (FcConfig
*config
)
308 config
= FcConfigGetCurrent ();
312 return FcStrListCreate (config
->configFiles
);
316 FcConfigSetCache (FcConfig
*config
,
319 FcChar8
*new = FcStrCopyFilename (c
);
324 FcStrFree (config
->cache
);
330 FcConfigGetCache (FcConfig
*config
)
334 config
= FcConfigGetCurrent ();
338 return config
->cache
;
342 FcConfigGetFonts (FcConfig
*config
,
347 config
= FcConfigGetCurrent ();
351 return config
->fonts
[set
];
355 FcConfigSetFonts (FcConfig
*config
,
359 if (config
->fonts
[set
])
360 FcFontSetDestroy (config
->fonts
[set
]);
361 config
->fonts
[set
] = fonts
;
367 FcConfigGetBlanks (FcConfig
*config
)
371 config
= FcConfigGetCurrent ();
375 return config
->blanks
;
379 FcConfigAddBlank (FcConfig
*config
,
387 b
= FcBlanksCreate ();
391 if (!FcBlanksAdd (b
, blank
))
398 FcConfigGetRescanInverval (FcConfig
*config
)
402 config
= FcConfigGetCurrent ();
406 return config
->rescanInterval
;
410 FcConfigSetRescanInverval (FcConfig
*config
, int rescanInterval
)
414 config
= FcConfigGetCurrent ();
418 config
->rescanInterval
= rescanInterval
;
423 FcConfigAddEdit (FcConfig
*config
,
428 FcSubst
*subst
, **prev
;
432 subst
= (FcSubst
*) malloc (sizeof (FcSubst
));
435 if (kind
== FcMatchPattern
)
436 prev
= &config
->substPattern
;
438 prev
= &config
->substFont
;
439 for (; *prev
; prev
= &(*prev
)->next
);
444 if (FcDebug () & FC_DBG_EDIT
)
446 printf ("Add Subst ");
447 FcSubstPrint (subst
);
450 for (t
= test
; t
; t
= t
->next
)
452 if (config
->maxObjects
< num
)
453 config
->maxObjects
= num
;
457 typedef struct _FcSubState
{
462 static const FcMatrix FcIdentityMatrix
= { 1, 0, 0, 1 };
465 FcConfigPromote (FcValue v
, FcValue u
)
467 if (v
.type
== FcTypeInteger
)
469 v
.type
= FcTypeDouble
;
470 v
.u
.d
= (double) v
.u
.i
;
472 else if (v
.type
== FcTypeVoid
&& u
.type
== FcTypeMatrix
)
474 v
.u
.m
= FcMatrixCopy (&FcIdentityMatrix
);
476 v
.type
= FcTypeMatrix
;
482 FcConfigCompareValue (FcValue m
,
486 FcBool ret
= FcFalse
;
488 m
= FcConfigPromote (m
, v
);
489 v
= FcConfigPromote (v
, m
);
490 if (m
.type
== v
.type
)
495 break; /* FcConfigPromote prevents this from happening */
500 ret
= m
.u
.d
== v
.u
.d
;
503 ret
= m
.u
.d
!= v
.u
.d
;
509 ret
= m
.u
.d
<= v
.u
.d
;
515 ret
= m
.u
.d
>= v
.u
.d
;
525 ret
= m
.u
.b
== v
.u
.b
;
528 ret
= m
.u
.b
!= v
.u
.b
;
538 ret
= FcStrCmpIgnoreCase (m
.u
.s
, v
.u
.s
) == 0;
541 ret
= FcStrCmpIgnoreCase (m
.u
.s
, v
.u
.s
) != 0;
551 ret
= FcMatrixEqual (m
.u
.m
, v
.u
.m
);
554 ret
= !FcMatrixEqual (m
.u
.m
, v
.u
.m
);
563 /* m contains v if v is a subset of m */
564 ret
= FcCharSetIsSubset (v
.u
.c
, m
.u
.c
);
567 ret
= FcCharSetEqual (m
.u
.c
, v
.u
.c
);
570 ret
= !FcCharSetEqual (m
.u
.c
, v
.u
.c
);
589 ret
= m
.u
.f
== v
.u
.f
;
592 ret
= m
.u
.f
!= v
.u
.f
;
601 if (op
== FcOpNotEqual
)
609 FcConfigEvaluate (FcPattern
*p
, FcExpr
*e
)
617 v
.type
= FcTypeInteger
;
621 v
.type
= FcTypeDouble
;
625 v
.type
= FcTypeString
;
630 v
.type
= FcTypeMatrix
;
635 v
.type
= FcTypeCharSet
;
644 r
= FcPatternGet (p
, e
->u
.field
, 0, &v
);
645 if (r
!= FcResultMatch
)
649 if (FcNameConstant (e
->u
.constant
, &v
.u
.i
))
650 v
.type
= FcTypeInteger
;
655 vl
= FcConfigEvaluate (p
, e
->u
.tree
.left
);
656 if (vl
.type
== FcTypeBool
)
659 v
= FcConfigEvaluate (p
, e
->u
.tree
.right
->u
.tree
.left
);
661 v
= FcConfigEvaluate (p
, e
->u
.tree
.right
->u
.tree
.right
);
680 vl
= FcConfigEvaluate (p
, e
->u
.tree
.left
);
681 vr
= FcConfigEvaluate (p
, e
->u
.tree
.right
);
682 vl
= FcConfigPromote (vl
, vr
);
683 vr
= FcConfigPromote (vr
, vl
);
684 if (vl
.type
== vr
.type
)
690 v
.type
= FcTypeDouble
;
691 v
.u
.d
= vl
.u
.d
+ vr
.u
.d
;
694 v
.type
= FcTypeDouble
;
695 v
.u
.d
= vl
.u
.d
- vr
.u
.d
;
698 v
.type
= FcTypeDouble
;
699 v
.u
.d
= vl
.u
.d
* vr
.u
.d
;
702 v
.type
= FcTypeDouble
;
703 v
.u
.d
= vl
.u
.d
/ vr
.u
.d
;
708 v
.u
.b
= vl
.u
.d
== vr
.u
.d
;
712 v
.u
.b
= vl
.u
.d
!= vr
.u
.d
;
716 v
.u
.b
= vl
.u
.d
< vr
.u
.d
;
720 v
.u
.b
= vl
.u
.d
<= vr
.u
.d
;
724 v
.u
.b
= vl
.u
.d
> vr
.u
.d
;
728 v
.u
.b
= vl
.u
.d
>= vr
.u
.d
;
734 if (v
.type
== FcTypeDouble
&&
735 v
.u
.d
== (double) (int) v
.u
.d
)
737 v
.type
= FcTypeInteger
;
745 v
.u
.b
= vl
.u
.b
|| vr
.u
.b
;
749 v
.u
.b
= vl
.u
.b
&& vr
.u
.b
;
754 v
.u
.b
= vl
.u
.b
== vr
.u
.b
;
758 v
.u
.b
= vl
.u
.b
!= vr
.u
.b
;
770 v
.u
.b
= FcStrCmpIgnoreCase (vl
.u
.s
, vr
.u
.s
) == 0;
774 v
.u
.b
= FcStrCmpIgnoreCase (vl
.u
.s
, vr
.u
.s
) != 0;
777 v
.type
= FcTypeString
;
778 v
.u
.s
= FcStrPlus (vl
.u
.s
, vr
.u
.s
);
791 v
.u
.b
= FcMatrixEqual (vl
.u
.m
, vr
.u
.m
);
795 v
.u
.b
= FcMatrixEqual (vl
.u
.m
, vr
.u
.m
);
798 v
.type
= FcTypeMatrix
;
799 m
= malloc (sizeof (FcMatrix
));
802 FcMemAlloc (FC_MEM_MATRIX
, sizeof (FcMatrix
));
803 FcMatrixMultiply (m
, vl
.u
.m
, vr
.u
.m
);
819 /* vl contains vr if vr is a subset of vl */
821 v
.u
.b
= FcCharSetIsSubset (vr
.u
.c
, vl
.u
.c
);
825 v
.u
.b
= FcCharSetEqual (vl
.u
.c
, vr
.u
.c
);
829 v
.u
.b
= !FcCharSetEqual (vl
.u
.c
, vr
.u
.c
);
847 vl
= FcConfigEvaluate (p
, e
->u
.tree
.left
);
867 FcConfigMatchValueList (FcPattern
*p
,
871 FcValueList
*ret
= 0;
877 if (e
->op
== FcOpComma
)
879 value
= FcConfigEvaluate (p
, e
->u
.tree
.left
);
884 value
= FcConfigEvaluate (p
, e
);
888 for (; v
; v
= v
->next
)
890 if (FcConfigCompareValue (v
->value
, t
->op
, value
))
897 if (t
->qual
== FcQualAll
)
904 FcValueDestroy (value
);
910 FcConfigValues (FcPattern
*p
, FcExpr
*e
)
916 l
= (FcValueList
*) malloc (sizeof (FcValueList
));
919 FcMemAlloc (FC_MEM_VALLIST
, sizeof (FcValueList
));
920 if (e
->op
== FcOpComma
)
922 l
->value
= FcConfigEvaluate (p
, e
->u
.tree
.left
);
923 l
->next
= FcConfigValues (p
, e
->u
.tree
.right
);
927 l
->value
= FcConfigEvaluate (p
, e
);
930 while (l
&& l
->value
.type
== FcTypeVoid
)
932 FcValueList
*next
= l
->next
;
934 FcMemFree (FC_MEM_VALLIST
, sizeof (FcValueList
));
942 FcConfigAdd (FcValueList
**head
,
943 FcValueList
*position
,
947 FcValueList
**prev
, *last
;
952 prev
= &position
->next
;
954 for (prev
= head
; *prev
; prev
= &(*prev
)->next
)
961 for (prev
= head
; *prev
; prev
= &(*prev
)->next
)
963 if (*prev
== position
)
970 if (FcDebug () & FC_DBG_EDIT
)
973 printf ("position not on list\n");
977 if (FcDebug () & FC_DBG_EDIT
)
979 printf ("%s list before ", append
? "Append" : "Prepend");
980 FcValueListPrint (*head
);
994 if (FcDebug () & FC_DBG_EDIT
)
996 printf ("%s list after ", append
? "Append" : "Prepend");
997 FcValueListPrint (*head
);
1005 FcConfigDel (FcValueList
**head
,
1006 FcValueList
*position
)
1010 for (prev
= head
; *prev
; prev
= &(*prev
)->next
)
1012 if (*prev
== position
)
1014 *prev
= position
->next
;
1016 FcValueListDestroy (position
);
1023 FcConfigPatternAdd (FcPattern
*p
,
1030 FcPatternElt
*e
= FcPatternInsertElt (p
, object
);
1034 FcConfigAdd (&e
->values
, 0, append
, list
);
1039 * Delete all values associated with a field
1042 FcConfigPatternDel (FcPattern
*p
,
1045 FcPatternElt
*e
= FcPatternFindElt (p
, object
);
1049 FcConfigDel (&e
->values
, e
->values
);
1053 FcConfigPatternCanon (FcPattern
*p
,
1056 FcPatternElt
*e
= FcPatternFindElt (p
, object
);
1060 FcPatternDel (p
, object
);
1064 FcConfigSubstitute (FcConfig
*config
,
1077 config
= FcConfigGetCurrent ();
1082 st
= (FcSubState
*) malloc (config
->maxObjects
* sizeof (FcSubState
));
1083 if (!st
&& config
->maxObjects
)
1085 FcMemAlloc (FC_MEM_SUBSTATE
, config
->maxObjects
* sizeof (FcSubState
));
1087 if (FcDebug () & FC_DBG_EDIT
)
1089 printf ("FcConfigSubstitute ");
1092 if (kind
== FcMatchPattern
)
1093 s
= config
->substPattern
;
1095 s
= config
->substFont
;
1096 for (; s
; s
= s
->next
)
1099 * Check the tests to see if
1100 * they all match the pattern
1102 for (t
= s
->test
, i
= 0; t
; t
= t
->next
, i
++)
1104 if (FcDebug () & FC_DBG_EDIT
)
1106 printf ("FcConfigSubstitute test ");
1109 st
[i
].elt
= FcPatternFindElt (p
, t
->field
);
1111 * If there's no such field in the font,
1112 * then FcQualAll matches while FcQualAny does not
1116 if (t
->qual
== FcQualAll
)
1125 * Check to see if there is a match, mark the location
1126 * to apply match-relative edits
1128 st
[i
].value
= FcConfigMatchValueList (p
, t
, st
[i
].elt
->values
);
1134 if (FcDebug () & FC_DBG_EDIT
)
1135 printf ("No match\n");
1138 if (FcDebug () & FC_DBG_EDIT
)
1140 printf ("Substitute ");
1143 for (e
= s
->edit
; e
; e
= e
->next
)
1146 * Evaluate the list of expressions
1148 l
= FcConfigValues (p
, e
->expr
);
1150 * Locate any test associated with this field
1152 for (t
= s
->test
, i
= 0; t
; t
= t
->next
, i
++)
1153 if (!FcStrCmpIgnoreCase ((FcChar8
*) t
->field
, (FcChar8
*) e
->field
))
1158 * If there was a test, then replace the matched
1159 * value with the new list of values
1163 FcValueList
*thisValue
= st
[i
].value
;
1164 FcValueList
*nextValue
= thisValue
? thisValue
->next
: 0;
1167 * Append the new list of values after the current value
1169 FcConfigAdd (&st
[i
].elt
->values
, thisValue
, FcTrue
, l
);
1171 * Delete the marked value
1173 FcConfigDel (&st
[i
].elt
->values
, thisValue
);
1175 * Adjust any pointers into the value list to ensure
1176 * future edits occur at the same place
1178 for (t
= s
->test
, i
= 0; t
; t
= t
->next
, i
++)
1180 if (st
[i
].value
== thisValue
)
1181 st
[i
].value
= nextValue
;
1185 /* fall through ... */
1186 case FcOpAssignReplace
:
1188 * Delete all of the values and insert
1191 FcConfigPatternDel (p
, e
->field
);
1192 FcConfigPatternAdd (p
, e
->field
, l
, FcTrue
);
1194 * Adjust any pointers into the value list as they no
1195 * longer point to anything valid
1199 FcPatternElt
*thisElt
= st
[i
].elt
;
1200 for (t
= s
->test
, i
= 0; t
; t
= t
->next
, i
++)
1202 if (st
[i
].elt
== thisElt
)
1210 FcConfigAdd (&st
[i
].elt
->values
, st
[i
].value
, FcFalse
, l
);
1213 /* fall through ... */
1214 case FcOpPrependFirst
:
1215 FcConfigPatternAdd (p
, e
->field
, l
, FcFalse
);
1220 FcConfigAdd (&st
[i
].elt
->values
, st
[i
].value
, FcTrue
, l
);
1223 /* fall through ... */
1224 case FcOpAppendLast
:
1225 FcConfigPatternAdd (p
, e
->field
, l
, FcTrue
);
1232 * Now go through the pattern and eliminate
1233 * any properties without data
1235 for (e
= s
->edit
; e
; e
= e
->next
)
1236 FcConfigPatternCanon (p
, e
->field
);
1238 if (FcDebug () & FC_DBG_EDIT
)
1240 printf ("FcConfigSubstitute edit");
1244 FcMemFree (FC_MEM_SUBSTATE
, config
->maxObjects
* sizeof (FcSubState
));
1246 if (FcDebug () & FC_DBG_EDIT
)
1248 printf ("FcConfigSubstitute done");
1254 #ifndef FONTCONFIG_PATH
1255 #define FONTCONFIG_PATH "/etc/fonts"
1258 #ifndef FONTCONFIG_FILE
1259 #define FONTCONFIG_FILE "fonts.conf"
1263 FcConfigFileExists (const FcChar8
*dir
, const FcChar8
*file
)
1268 dir
= (FcChar8
*) "";
1269 path
= malloc (strlen ((char *) dir
) + 1 + strlen ((char *) file
) + 1);
1273 strcpy ((char *) path
, (const char *) dir
);
1274 /* make sure there's a single separating / */
1275 if ((!path
[0] || path
[strlen((char *) path
)-1] != '/') && file
[0] != '/')
1276 strcat ((char *) path
, "/");
1277 strcat ((char *) path
, (char *) file
);
1279 if (access ((char *) path
, R_OK
) == 0)
1287 FcConfigGetPath (void)
1290 FcChar8
*env
, *e
, *colon
;
1295 npath
= 2; /* default dir + null */
1296 env
= (FcChar8
*) getenv ("FONTCONFIG_PATH");
1305 path
= calloc (npath
, sizeof (FcChar8
*));
1315 colon
= (FcChar8
*) strchr ((char *) e
, ':');
1317 colon
= e
+ strlen ((char *) e
);
1318 path
[i
] = malloc (colon
- e
+ 1);
1321 strncpy ((char *) path
[i
], (const char *) e
, colon
- e
);
1322 path
[i
][colon
- e
] = '\0';
1331 dir
= (FcChar8
*) FONTCONFIG_PATH
;
1332 path
[i
] = malloc (strlen ((char *) dir
) + 1);
1335 strcpy ((char *) path
[i
], (const char *) dir
);
1339 for (i
= 0; path
[i
]; i
++)
1347 FcConfigFreePath (FcChar8
**path
)
1351 for (p
= path
; *p
; p
++)
1357 FcConfigFilename (const FcChar8
*url
)
1359 FcChar8
*file
, *dir
, **path
, **p
;
1363 url
= (FcChar8
*) getenv ("FONTCONFIG_FILE");
1365 url
= (FcChar8
*) FONTCONFIG_FILE
;
1370 dir
= (FcChar8
*) getenv ("HOME");
1372 file
= FcConfigFileExists (dir
, url
+ 1);
1377 file
= FcConfigFileExists (0, url
);
1380 path
= FcConfigGetPath ();
1383 for (p
= path
; *p
; p
++)
1385 file
= FcConfigFileExists (*p
, url
);
1389 FcConfigFreePath (path
);
1396 * Manage the application-specific fonts
1400 FcConfigAppFontAddFile (FcConfig
*config
,
1401 const FcChar8
*file
)
1410 config
= FcConfigGetCurrent ();
1415 subdirs
= FcStrSetCreate ();
1419 set
= FcConfigGetFonts (config
, FcSetApplication
);
1422 set
= FcFontSetCreate ();
1425 FcStrSetDestroy (subdirs
);
1428 FcConfigSetFonts (config
, set
, FcSetApplication
);
1431 if (!FcFileScan (set
, subdirs
, 0, config
->blanks
, file
, FcFalse
))
1433 FcStrSetDestroy (subdirs
);
1436 if ((sublist
= FcStrListCreate (subdirs
)))
1438 while ((subdir
= FcStrListNext (sublist
)))
1440 FcConfigAppFontAddDir (config
, subdir
);
1442 FcStrListDone (sublist
);
1448 FcConfigAppFontAddDir (FcConfig
*config
,
1458 config
= FcConfigGetCurrent ();
1462 subdirs
= FcStrSetCreate ();
1466 set
= FcConfigGetFonts (config
, FcSetApplication
);
1469 set
= FcFontSetCreate ();
1472 FcStrSetDestroy (subdirs
);
1475 FcConfigSetFonts (config
, set
, FcSetApplication
);
1478 if (!FcDirScan (set
, subdirs
, 0, config
->blanks
, dir
, FcFalse
))
1480 FcStrSetDestroy (subdirs
);
1483 if ((sublist
= FcStrListCreate (subdirs
)))
1485 while ((subdir
= FcStrListNext (sublist
)))
1487 FcConfigAppFontAddDir (config
, subdir
);
1489 FcStrListDone (sublist
);
1495 FcConfigAppFontClear (FcConfig
*config
)
1497 FcConfigSetFonts (config
, 0, FcSetApplication
);