]>
git.wh0rd.org - fontconfig.git/blob - src/fccfg.c
2 * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.15 2002/06/21 06:14:45 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
));
82 typedef struct _FcFileTime
{
88 FcConfigNewestFile (FcStrSet
*files
)
90 FcStrList
*list
= FcStrListCreate (files
);
91 FcFileTime newest
= { 0, FcFalse
};
97 while ((file
= FcStrListNext (list
)))
98 if (stat ((char *) file
, &statb
) == 0)
99 if (!newest
.set
|| statb
.st_mtime
- newest
.time
> 0)
100 newest
.time
= statb
.st_mtime
;
101 FcStrListDone (list
);
107 FcConfigUptoDate (FcConfig
*config
)
109 FcFileTime config_time
, font_time
;
110 time_t now
= time(0);
113 config
= FcConfigGetCurrent ();
117 config_time
= FcConfigNewestFile (config
->configFiles
);
118 font_time
= FcConfigNewestFile (config
->configDirs
);
119 if ((config_time
.set
&& config_time
.time
- config
->rescanTime
> 0) ||
120 (font_time
.set
&& font_time
.time
- config
->rescanTime
) > 0)
124 config
->rescanTime
= now
;
129 FcSubstDestroy (FcSubst
*s
)
136 FcTestDestroy (s
->test
);
137 FcEditDestroy (s
->edit
);
143 FcConfigDestroy (FcConfig
*config
)
147 if (config
== _fcConfig
)
150 FcStrSetDestroy (config
->configDirs
);
151 FcStrSetDestroy (config
->fontDirs
);
152 FcStrSetDestroy (config
->configFiles
);
154 FcStrFree (config
->cache
);
156 FcSubstDestroy (config
->substPattern
);
157 FcSubstDestroy (config
->substFont
);
158 for (set
= FcSetSystem
; set
<= FcSetApplication
; set
++)
159 if (config
->fonts
[set
])
160 FcFontSetDestroy (config
->fonts
[set
]);
162 FcMemFree (FC_MEM_CONFIG
, sizeof (FcConfig
));
166 * Scan the current list of directories in the configuration
167 * and build the set of available fonts. Update the
168 * per-user cache file to reflect the new configuration
172 FcConfigBuildFonts (FcConfig
*config
)
175 FcGlobalCache
*cache
;
179 fonts
= FcFontSetCreate ();
183 cache
= FcGlobalCacheCreate ();
187 FcGlobalCacheLoad (cache
, config
->cache
);
189 list
= FcConfigGetFontDirs (config
);
193 while ((dir
= FcStrListNext (list
)))
195 if (FcDebug () & FC_DBG_FONTSET
)
196 printf ("scan dir %s\n", dir
);
197 FcDirScan (fonts
, config
->fontDirs
, cache
, config
->blanks
, dir
, FcFalse
);
200 FcStrListDone (list
);
202 if (FcDebug () & FC_DBG_FONTSET
)
203 FcFontSetPrint (fonts
);
205 FcGlobalCacheSave (cache
, config
->cache
);
206 FcGlobalCacheDestroy (cache
);
208 FcConfigSetFonts (config
, fonts
, FcSetSystem
);
212 FcFontSetDestroy (fonts
);
218 FcConfigSetCurrent (FcConfig
*config
)
221 if (!FcConfigBuildFonts (config
))
225 FcConfigDestroy (_fcConfig
);
231 FcConfigGetCurrent (void)
240 FcConfigAddConfigDir (FcConfig
*config
,
243 return FcStrSetAddFilename (config
->configDirs
, d
);
247 FcConfigGetConfigDirs (FcConfig
*config
)
251 config
= FcConfigGetCurrent ();
255 return FcStrListCreate (config
->configDirs
);
259 FcConfigAddFontDir (FcConfig
*config
,
262 return FcStrSetAddFilename (config
->fontDirs
, d
);
266 FcConfigAddDir (FcConfig
*config
,
269 return (FcConfigAddConfigDir (config
, d
) &&
270 FcConfigAddFontDir (config
, d
));
274 FcConfigGetFontDirs (FcConfig
*config
)
278 config
= FcConfigGetCurrent ();
282 return FcStrListCreate (config
->fontDirs
);
286 FcConfigAddConfigFile (FcConfig
*config
,
290 FcChar8
*file
= FcConfigFilename (f
);
295 ret
= FcStrSetAdd (config
->configFiles
, file
);
301 FcConfigGetConfigFiles (FcConfig
*config
)
305 config
= FcConfigGetCurrent ();
309 return FcStrListCreate (config
->configFiles
);
313 FcConfigSetCache (FcConfig
*config
,
316 FcChar8
*new = FcStrCopyFilename (c
);
321 FcStrFree (config
->cache
);
327 FcConfigGetCache (FcConfig
*config
)
331 config
= FcConfigGetCurrent ();
335 return config
->cache
;
339 FcConfigGetFonts (FcConfig
*config
,
344 config
= FcConfigGetCurrent ();
348 return config
->fonts
[set
];
352 FcConfigSetFonts (FcConfig
*config
,
356 if (config
->fonts
[set
])
357 FcFontSetDestroy (config
->fonts
[set
]);
358 config
->fonts
[set
] = fonts
;
364 FcConfigGetBlanks (FcConfig
*config
)
368 config
= FcConfigGetCurrent ();
372 return config
->blanks
;
376 FcConfigAddBlank (FcConfig
*config
,
384 b
= FcBlanksCreate ();
388 if (!FcBlanksAdd (b
, blank
))
395 FcConfigGetRescanInverval (FcConfig
*config
)
399 config
= FcConfigGetCurrent ();
403 return config
->rescanInterval
;
407 FcConfigSetRescanInverval (FcConfig
*config
, int rescanInterval
)
411 config
= FcConfigGetCurrent ();
415 config
->rescanInterval
= rescanInterval
;
420 FcConfigAddEdit (FcConfig
*config
,
425 FcSubst
*subst
, **prev
;
429 subst
= (FcSubst
*) malloc (sizeof (FcSubst
));
432 if (kind
== FcMatchPattern
)
433 prev
= &config
->substPattern
;
435 prev
= &config
->substFont
;
436 for (; *prev
; prev
= &(*prev
)->next
);
441 if (FcDebug () & FC_DBG_EDIT
)
443 printf ("Add Subst ");
444 FcSubstPrint (subst
);
447 for (t
= test
; t
; t
= t
->next
)
449 if (config
->maxObjects
< num
)
450 config
->maxObjects
= num
;
454 typedef struct _FcSubState
{
460 FcConfigPromote (FcValue v
, FcValue u
)
462 if (v
.type
== FcTypeInteger
)
464 v
.type
= FcTypeDouble
;
465 v
.u
.d
= (double) v
.u
.i
;
467 else if (v
.type
== FcTypeVoid
&& u
.type
== FcTypeMatrix
)
469 v
.u
.m
= &FcIdentityMatrix
;
470 v
.type
= FcTypeMatrix
;
476 FcConfigCompareValue (FcValue m
,
480 FcBool ret
= FcFalse
;
482 m
= FcConfigPromote (m
, v
);
483 v
= FcConfigPromote (v
, m
);
484 if (m
.type
== v
.type
)
489 break; /* FcConfigPromote prevents this from happening */
494 ret
= m
.u
.d
== v
.u
.d
;
497 ret
= m
.u
.d
!= v
.u
.d
;
503 ret
= m
.u
.d
<= v
.u
.d
;
509 ret
= m
.u
.d
>= v
.u
.d
;
519 ret
= m
.u
.b
== v
.u
.b
;
522 ret
= m
.u
.b
!= v
.u
.b
;
532 ret
= FcStrCmpIgnoreCase (m
.u
.s
, v
.u
.s
) == 0;
535 ret
= FcStrCmpIgnoreCase (m
.u
.s
, v
.u
.s
) != 0;
545 ret
= FcMatrixEqual (m
.u
.m
, v
.u
.m
);
548 ret
= !FcMatrixEqual (m
.u
.m
, v
.u
.m
);
557 /* m contains v if v is a subset of m */
558 ret
= FcCharSetIsSubset (v
.u
.c
, m
.u
.c
);
561 ret
= FcCharSetEqual (m
.u
.c
, v
.u
.c
);
564 ret
= !FcCharSetEqual (m
.u
.c
, v
.u
.c
);
583 ret
= m
.u
.f
== v
.u
.f
;
586 ret
= m
.u
.f
!= v
.u
.f
;
595 if (op
== FcOpNotEqual
)
603 FcConfigEvaluate (FcPattern
*p
, FcExpr
*e
)
611 v
.type
= FcTypeInteger
;
615 v
.type
= FcTypeDouble
;
619 v
.type
= FcTypeString
;
624 v
.type
= FcTypeMatrix
;
629 v
.type
= FcTypeCharSet
;
638 r
= FcPatternGet (p
, e
->u
.field
, 0, &v
);
639 if (r
!= FcResultMatch
)
643 if (FcNameConstant (e
->u
.constant
, &v
.u
.i
))
644 v
.type
= FcTypeInteger
;
649 vl
= FcConfigEvaluate (p
, e
->u
.tree
.left
);
650 if (vl
.type
== FcTypeBool
)
653 v
= FcConfigEvaluate (p
, e
->u
.tree
.right
->u
.tree
.left
);
655 v
= FcConfigEvaluate (p
, e
->u
.tree
.right
->u
.tree
.right
);
674 vl
= FcConfigEvaluate (p
, e
->u
.tree
.left
);
675 vr
= FcConfigEvaluate (p
, e
->u
.tree
.right
);
676 vl
= FcConfigPromote (vl
, vr
);
677 vr
= FcConfigPromote (vr
, vl
);
678 if (vl
.type
== vr
.type
)
684 v
.type
= FcTypeDouble
;
685 v
.u
.d
= vl
.u
.d
+ vr
.u
.d
;
688 v
.type
= FcTypeDouble
;
689 v
.u
.d
= vl
.u
.d
- vr
.u
.d
;
692 v
.type
= FcTypeDouble
;
693 v
.u
.d
= vl
.u
.d
* vr
.u
.d
;
696 v
.type
= FcTypeDouble
;
697 v
.u
.d
= vl
.u
.d
/ vr
.u
.d
;
702 v
.u
.b
= vl
.u
.d
== vr
.u
.d
;
706 v
.u
.b
= vl
.u
.d
!= vr
.u
.d
;
710 v
.u
.b
= vl
.u
.d
< vr
.u
.d
;
714 v
.u
.b
= vl
.u
.d
<= vr
.u
.d
;
718 v
.u
.b
= vl
.u
.d
> vr
.u
.d
;
722 v
.u
.b
= vl
.u
.d
>= vr
.u
.d
;
728 if (v
.type
== FcTypeDouble
&&
729 v
.u
.d
== (double) (int) v
.u
.d
)
731 v
.type
= FcTypeInteger
;
739 v
.u
.b
= vl
.u
.b
|| vr
.u
.b
;
743 v
.u
.b
= vl
.u
.b
&& vr
.u
.b
;
748 v
.u
.b
= vl
.u
.b
== vr
.u
.b
;
752 v
.u
.b
= vl
.u
.b
!= vr
.u
.b
;
764 v
.u
.b
= FcStrCmpIgnoreCase (vl
.u
.s
, vr
.u
.s
) == 0;
768 v
.u
.b
= FcStrCmpIgnoreCase (vl
.u
.s
, vr
.u
.s
) != 0;
771 v
.type
= FcTypeString
;
772 v
.u
.s
= FcStrPlus (vl
.u
.s
, vr
.u
.s
);
786 v
.u
.b
= FcMatrixEqual (vl
.u
.m
, vr
.u
.m
);
790 v
.u
.b
= FcMatrixEqual (vl
.u
.m
, vr
.u
.m
);
793 v
.type
= FcTypeMatrix
;
794 m
= malloc (sizeof (FcMatrix
));
797 FcMemAlloc (FC_MEM_MATRIX
, sizeof (FcMatrix
));
798 FcMatrixMultiply (m
, vl
.u
.m
, vr
.u
.m
);
814 /* vl contains vr if vr is a subset of vl */
816 v
.u
.b
= FcCharSetIsSubset (vr
.u
.c
, vl
.u
.c
);
820 v
.u
.b
= FcCharSetEqual (vl
.u
.c
, vr
.u
.c
);
824 v
.u
.b
= !FcCharSetEqual (vl
.u
.c
, vr
.u
.c
);
842 vl
= FcConfigEvaluate (p
, e
->u
.tree
.left
);
862 FcConfigMatchValueList (FcPattern
*p
,
866 FcValueList
*ret
= 0;
873 if (e
->op
== FcOpComma
)
875 value
= FcConfigEvaluate (p
, e
->u
.tree
.left
);
880 value
= FcConfigEvaluate (p
, e
);
884 for (v
= values
; v
; v
= v
->next
)
886 if (FcConfigCompareValue (v
->value
, t
->op
, value
))
893 if (t
->qual
== FcQualAll
)
900 FcValueDestroy (value
);
906 FcConfigValues (FcPattern
*p
, FcExpr
*e
)
912 l
= (FcValueList
*) malloc (sizeof (FcValueList
));
915 FcMemAlloc (FC_MEM_VALLIST
, sizeof (FcValueList
));
916 if (e
->op
== FcOpComma
)
918 l
->value
= FcConfigEvaluate (p
, e
->u
.tree
.left
);
919 l
->next
= FcConfigValues (p
, e
->u
.tree
.right
);
923 l
->value
= FcConfigEvaluate (p
, e
);
926 l
->binding
= FcValueBindingWeak
;
927 while (l
&& l
->value
.type
== FcTypeVoid
)
929 FcValueList
*next
= l
->next
;
931 FcMemFree (FC_MEM_VALLIST
, sizeof (FcValueList
));
939 FcConfigAdd (FcValueList
**head
,
940 FcValueList
*position
,
944 FcValueList
**prev
, *last
;
949 prev
= &position
->next
;
951 for (prev
= head
; *prev
; prev
= &(*prev
)->next
)
958 for (prev
= head
; *prev
; prev
= &(*prev
)->next
)
960 if (*prev
== position
)
967 if (FcDebug () & FC_DBG_EDIT
)
970 printf ("position not on list\n");
974 if (FcDebug () & FC_DBG_EDIT
)
976 printf ("%s list before ", append
? "Append" : "Prepend");
977 FcValueListPrint (*head
);
991 if (FcDebug () & FC_DBG_EDIT
)
993 printf ("%s list after ", append
? "Append" : "Prepend");
994 FcValueListPrint (*head
);
1002 FcConfigDel (FcValueList
**head
,
1003 FcValueList
*position
)
1007 for (prev
= head
; *prev
; prev
= &(*prev
)->next
)
1009 if (*prev
== position
)
1011 *prev
= position
->next
;
1013 FcValueListDestroy (position
);
1020 FcConfigPatternAdd (FcPattern
*p
,
1027 FcPatternElt
*e
= FcPatternInsertElt (p
, object
);
1031 FcConfigAdd (&e
->values
, 0, append
, list
);
1036 * Delete all values associated with a field
1039 FcConfigPatternDel (FcPattern
*p
,
1042 FcPatternElt
*e
= FcPatternFindElt (p
, object
);
1046 FcConfigDel (&e
->values
, e
->values
);
1050 FcConfigPatternCanon (FcPattern
*p
,
1053 FcPatternElt
*e
= FcPatternFindElt (p
, object
);
1057 FcPatternDel (p
, object
);
1061 FcConfigSubstitute (FcConfig
*config
,
1074 config
= FcConfigGetCurrent ();
1079 st
= (FcSubState
*) malloc (config
->maxObjects
* sizeof (FcSubState
));
1080 if (!st
&& config
->maxObjects
)
1082 FcMemAlloc (FC_MEM_SUBSTATE
, config
->maxObjects
* sizeof (FcSubState
));
1084 if (FcDebug () & FC_DBG_EDIT
)
1086 printf ("FcConfigSubstitute ");
1089 if (kind
== FcMatchPattern
)
1090 s
= config
->substPattern
;
1092 s
= config
->substFont
;
1093 for (; s
; s
= s
->next
)
1096 * Check the tests to see if
1097 * they all match the pattern
1099 for (t
= s
->test
, i
= 0; t
; t
= t
->next
, i
++)
1101 if (FcDebug () & FC_DBG_EDIT
)
1103 printf ("FcConfigSubstitute test ");
1106 st
[i
].elt
= FcPatternFindElt (p
, t
->field
);
1108 * If there's no such field in the font,
1109 * then FcQualAll matches while FcQualAny does not
1113 if (t
->qual
== FcQualAll
)
1122 * Check to see if there is a match, mark the location
1123 * to apply match-relative edits
1125 st
[i
].value
= FcConfigMatchValueList (p
, t
, st
[i
].elt
->values
);
1128 if (t
->qual
== FcQualFirst
&& st
[i
].value
!= st
[i
].elt
->values
)
1130 if (t
->qual
== FcQualNotFirst
&& st
[i
].value
== st
[i
].elt
->values
)
1135 if (FcDebug () & FC_DBG_EDIT
)
1136 printf ("No match\n");
1139 if (FcDebug () & FC_DBG_EDIT
)
1141 printf ("Substitute ");
1144 for (e
= s
->edit
; e
; e
= e
->next
)
1147 * Evaluate the list of expressions
1149 l
= FcConfigValues (p
, e
->expr
);
1151 * Locate any test associated with this field
1153 for (t
= s
->test
, i
= 0; t
; t
= t
->next
, i
++)
1154 if (!FcStrCmpIgnoreCase ((FcChar8
*) t
->field
, (FcChar8
*) e
->field
))
1159 * If there was a test, then replace the matched
1160 * value with the new list of values
1164 FcValueList
*thisValue
= st
[i
].value
;
1165 FcValueList
*nextValue
= thisValue
? thisValue
->next
: 0;
1168 * Append the new list of values after the current value
1170 FcConfigAdd (&st
[i
].elt
->values
, thisValue
, FcTrue
, l
);
1172 * Delete the marked value
1174 FcConfigDel (&st
[i
].elt
->values
, thisValue
);
1176 * Adjust any pointers into the value list to ensure
1177 * future edits occur at the same place
1179 for (t
= s
->test
, i
= 0; t
; t
= t
->next
, i
++)
1181 if (st
[i
].value
== thisValue
)
1182 st
[i
].value
= nextValue
;
1186 /* fall through ... */
1187 case FcOpAssignReplace
:
1189 * Delete all of the values and insert
1192 FcConfigPatternDel (p
, e
->field
);
1193 FcConfigPatternAdd (p
, e
->field
, l
, FcTrue
);
1195 * Adjust any pointers into the value list as they no
1196 * longer point to anything valid
1200 FcPatternElt
*thisElt
= st
[i
].elt
;
1201 for (t
= s
->test
, i
= 0; t
; t
= t
->next
, i
++)
1203 if (st
[i
].elt
== thisElt
)
1211 FcConfigAdd (&st
[i
].elt
->values
, st
[i
].value
, FcFalse
, l
);
1214 /* fall through ... */
1215 case FcOpPrependFirst
:
1216 FcConfigPatternAdd (p
, e
->field
, l
, FcFalse
);
1221 FcConfigAdd (&st
[i
].elt
->values
, st
[i
].value
, FcTrue
, l
);
1224 /* fall through ... */
1225 case FcOpAppendLast
:
1226 FcConfigPatternAdd (p
, e
->field
, l
, FcTrue
);
1233 * Now go through the pattern and eliminate
1234 * any properties without data
1236 for (e
= s
->edit
; e
; e
= e
->next
)
1237 FcConfigPatternCanon (p
, e
->field
);
1239 if (FcDebug () & FC_DBG_EDIT
)
1241 printf ("FcConfigSubstitute edit");
1245 FcMemFree (FC_MEM_SUBSTATE
, config
->maxObjects
* sizeof (FcSubState
));
1247 if (FcDebug () & FC_DBG_EDIT
)
1249 printf ("FcConfigSubstitute done");
1255 #ifndef FONTCONFIG_PATH
1256 #define FONTCONFIG_PATH "/etc/fonts"
1259 #ifndef FONTCONFIG_FILE
1260 #define FONTCONFIG_FILE "fonts.conf"
1264 FcConfigFileExists (const FcChar8
*dir
, const FcChar8
*file
)
1269 dir
= (FcChar8
*) "";
1270 path
= malloc (strlen ((char *) dir
) + 1 + strlen ((char *) file
) + 1);
1274 strcpy ((char *) path
, (const char *) dir
);
1275 /* make sure there's a single separating / */
1276 if ((!path
[0] || path
[strlen((char *) path
)-1] != '/') && file
[0] != '/')
1277 strcat ((char *) path
, "/");
1278 strcat ((char *) path
, (char *) file
);
1280 if (access ((char *) path
, R_OK
) == 0)
1288 FcConfigGetPath (void)
1291 FcChar8
*env
, *e
, *colon
;
1296 npath
= 2; /* default dir + null */
1297 env
= (FcChar8
*) getenv ("FONTCONFIG_PATH");
1306 path
= calloc (npath
, sizeof (FcChar8
*));
1316 colon
= (FcChar8
*) strchr ((char *) e
, ':');
1318 colon
= e
+ strlen ((char *) e
);
1319 path
[i
] = malloc (colon
- e
+ 1);
1322 strncpy ((char *) path
[i
], (const char *) e
, colon
- e
);
1323 path
[i
][colon
- e
] = '\0';
1332 dir
= (FcChar8
*) FONTCONFIG_PATH
;
1333 path
[i
] = malloc (strlen ((char *) dir
) + 1);
1336 strcpy ((char *) path
[i
], (const char *) dir
);
1340 for (i
= 0; path
[i
]; i
++)
1348 FcConfigFreePath (FcChar8
**path
)
1352 for (p
= path
; *p
; p
++)
1358 FcConfigFilename (const FcChar8
*url
)
1360 FcChar8
*file
, *dir
, **path
, **p
;
1364 url
= (FcChar8
*) getenv ("FONTCONFIG_FILE");
1366 url
= (FcChar8
*) FONTCONFIG_FILE
;
1371 dir
= (FcChar8
*) getenv ("HOME");
1373 file
= FcConfigFileExists (dir
, url
+ 1);
1378 file
= FcConfigFileExists (0, url
);
1381 path
= FcConfigGetPath ();
1384 for (p
= path
; *p
; p
++)
1386 file
= FcConfigFileExists (*p
, url
);
1390 FcConfigFreePath (path
);
1397 * Manage the application-specific fonts
1401 FcConfigAppFontAddFile (FcConfig
*config
,
1402 const FcChar8
*file
)
1411 config
= FcConfigGetCurrent ();
1416 subdirs
= FcStrSetCreate ();
1420 set
= FcConfigGetFonts (config
, FcSetApplication
);
1423 set
= FcFontSetCreate ();
1426 FcStrSetDestroy (subdirs
);
1429 FcConfigSetFonts (config
, set
, FcSetApplication
);
1432 if (!FcFileScan (set
, subdirs
, 0, config
->blanks
, file
, FcFalse
))
1434 FcStrSetDestroy (subdirs
);
1437 if ((sublist
= FcStrListCreate (subdirs
)))
1439 while ((subdir
= FcStrListNext (sublist
)))
1441 FcConfigAppFontAddDir (config
, subdir
);
1443 FcStrListDone (sublist
);
1449 FcConfigAppFontAddDir (FcConfig
*config
,
1459 config
= FcConfigGetCurrent ();
1463 subdirs
= FcStrSetCreate ();
1467 set
= FcConfigGetFonts (config
, FcSetApplication
);
1470 set
= FcFontSetCreate ();
1473 FcStrSetDestroy (subdirs
);
1476 FcConfigSetFonts (config
, set
, FcSetApplication
);
1479 if (!FcDirScan (set
, subdirs
, 0, config
->blanks
, dir
, FcFalse
))
1481 FcStrSetDestroy (subdirs
);
1484 if ((sublist
= FcStrListCreate (subdirs
)))
1486 while ((subdir
= FcStrListNext (sublist
)))
1488 FcConfigAppFontAddDir (config
, subdir
);
1490 FcStrListDone (sublist
);
1496 FcConfigAppFontClear (FcConfig
*config
)
1498 FcConfigSetFonts (config
, 0, FcSetApplication
);