]>
Commit | Line | Data |
---|---|---|
24330d27 | 1 | /* |
793e946c | 2 | * $RCSId: xc/lib/fontconfig/src/fclist.c,v 1.11tsi Exp $ |
24330d27 | 3 | * |
46b51147 | 4 | * Copyright © 2000 Keith Packard |
24330d27 KP |
5 | * |
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. | |
15 | * | |
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. | |
23 | */ | |
24 | ||
25 | #include <stdlib.h> | |
26 | #include "fcint.h" | |
27 | ||
28 | FcObjectSet * | |
29 | FcObjectSetCreate (void) | |
30 | { | |
31 | FcObjectSet *os; | |
32 | ||
33 | os = (FcObjectSet *) malloc (sizeof (FcObjectSet)); | |
34 | if (!os) | |
35 | return 0; | |
36 | FcMemAlloc (FC_MEM_OBJECTSET, sizeof (FcObjectSet)); | |
37 | os->nobject = 0; | |
38 | os->sobject = 0; | |
39 | os->objects = 0; | |
40 | return os; | |
41 | } | |
42 | ||
43 | FcBool | |
44 | FcObjectSetAdd (FcObjectSet *os, const char *object) | |
45 | { | |
46 | int s; | |
4262e0b3 | 47 | const char **objects; |
e9be9cd1 | 48 | int high, low, mid, c; |
24330d27 KP |
49 | |
50 | if (os->nobject == os->sobject) | |
51 | { | |
52 | s = os->sobject + 4; | |
53 | if (os->objects) | |
4262e0b3 PL |
54 | objects = (const char **) realloc ((void *) os->objects, |
55 | s * sizeof (const char *)); | |
24330d27 | 56 | else |
4262e0b3 | 57 | objects = (const char **) malloc (s * sizeof (const char *)); |
24330d27 KP |
58 | if (!objects) |
59 | return FcFalse; | |
60 | if (os->sobject) | |
61 | FcMemFree (FC_MEM_OBJECTPTR, os->sobject * sizeof (const char *)); | |
62 | FcMemAlloc (FC_MEM_OBJECTPTR, s * sizeof (const char *)); | |
63 | os->objects = objects; | |
64 | os->sobject = s; | |
65 | } | |
e9be9cd1 KP |
66 | high = os->nobject - 1; |
67 | low = 0; | |
68 | mid = 0; | |
69 | c = 1; | |
8245771d | 70 | object = (char *)FcStrStaticName ((FcChar8 *)object); |
e9be9cd1 KP |
71 | while (low <= high) |
72 | { | |
73 | mid = (low + high) >> 1; | |
4262e0b3 | 74 | c = os->objects[mid] - object; |
e9be9cd1 KP |
75 | if (c == 0) |
76 | return FcTrue; | |
77 | if (c < 0) | |
78 | low = mid + 1; | |
79 | else | |
80 | high = mid - 1; | |
81 | } | |
82 | if (c < 0) | |
83 | mid++; | |
5b1bfa5d | 84 | memmove (os->objects + mid + 1, os->objects + mid, |
4262e0b3 PL |
85 | (os->nobject - mid) * sizeof (const char *)); |
86 | os->objects[mid] = object; | |
e9be9cd1 | 87 | os->nobject++; |
24330d27 KP |
88 | return FcTrue; |
89 | } | |
90 | ||
91 | void | |
92 | FcObjectSetDestroy (FcObjectSet *os) | |
93 | { | |
94 | if (os->objects) | |
95 | { | |
96 | FcMemFree (FC_MEM_OBJECTPTR, os->sobject * sizeof (const char *)); | |
97 | free ((void *) os->objects); | |
98 | } | |
99 | FcMemFree (FC_MEM_OBJECTSET, sizeof (FcObjectSet)); | |
100 | free (os); | |
101 | } | |
102 | ||
103 | FcObjectSet * | |
104 | FcObjectSetVaBuild (const char *first, va_list va) | |
105 | { | |
106 | FcObjectSet *ret; | |
107 | ||
108 | FcObjectSetVapBuild (ret, first, va); | |
109 | return ret; | |
110 | } | |
111 | ||
112 | FcObjectSet * | |
113 | FcObjectSetBuild (const char *first, ...) | |
114 | { | |
115 | va_list va; | |
116 | FcObjectSet *os; | |
117 | ||
118 | va_start (va, first); | |
119 | FcObjectSetVapBuild (os, first, va); | |
120 | va_end (va); | |
121 | return os; | |
122 | } | |
123 | ||
74a623e0 KP |
124 | /* |
125 | * Font must have a containing value for every value in the pattern | |
126 | */ | |
24330d27 | 127 | static FcBool |
cd2ec1a9 PL |
128 | FcListValueListMatchAny (FcValueListPtr patOrig, /* pattern */ |
129 | FcValueListPtr fntOrig) /* font */ | |
24330d27 | 130 | { |
cd2ec1a9 | 131 | FcValueListPtr pat, fnt; |
24330d27 | 132 | |
cd2ec1a9 PL |
133 | for (pat = patOrig; FcValueListPtrU(pat); |
134 | pat = FcValueListPtrU(pat)->next) | |
74a623e0 | 135 | { |
cd2ec1a9 PL |
136 | for (fnt = fntOrig; FcValueListPtrU(fnt); |
137 | fnt = FcValueListPtrU(fnt)->next) | |
74a623e0 KP |
138 | { |
139 | /* | |
140 | * make sure the font 'contains' the pattern. | |
141 | * (OpListing is OpContains except for strings | |
142 | * where it requires an exact match) | |
143 | */ | |
4262e0b3 | 144 | if (FcConfigCompareValue (&FcValueListPtrU(fnt)->value, |
74a623e0 | 145 | FcOpListing, |
4262e0b3 | 146 | &FcValueListPtrU(pat)->value)) |
74a623e0 KP |
147 | break; |
148 | } | |
cd2ec1a9 | 149 | if (!FcValueListPtrU(fnt)) |
74a623e0 KP |
150 | return FcFalse; |
151 | } | |
152 | return FcTrue; | |
24330d27 KP |
153 | } |
154 | ||
155 | static FcBool | |
cd2ec1a9 PL |
156 | FcListValueListEqual (FcValueListPtr v1orig, |
157 | FcValueListPtr v2orig) | |
24330d27 | 158 | { |
cd2ec1a9 | 159 | FcValueListPtr v1, v2; |
24330d27 | 160 | |
cd2ec1a9 PL |
161 | for (v1 = v1orig; FcValueListPtrU(v1); |
162 | v1 = FcValueListPtrU(v1)->next) | |
24330d27 | 163 | { |
cd2ec1a9 PL |
164 | for (v2 = v2orig; FcValueListPtrU(v2); |
165 | v2 = FcValueListPtrU(v2)->next) | |
4262e0b3 PL |
166 | if (FcValueEqual (FcValueCanonicalize(&FcValueListPtrU(v1)->value), |
167 | FcValueCanonicalize(&FcValueListPtrU(v2)->value))) | |
24330d27 | 168 | break; |
cd2ec1a9 | 169 | if (!FcValueListPtrU(v2)) |
24330d27 KP |
170 | return FcFalse; |
171 | } | |
cd2ec1a9 PL |
172 | for (v2 = v2orig; FcValueListPtrU(v2); |
173 | v2 = FcValueListPtrU(v2)->next) | |
24330d27 | 174 | { |
cd2ec1a9 PL |
175 | for (v1 = v1orig; FcValueListPtrU(v1); |
176 | v1 = FcValueListPtrU(v1)->next) | |
4262e0b3 PL |
177 | if (FcValueEqual (FcValueCanonicalize(&FcValueListPtrU(v1)->value), |
178 | FcValueCanonicalize(&FcValueListPtrU(v2)->value))) | |
24330d27 | 179 | break; |
cd2ec1a9 | 180 | if (!FcValueListPtrU(v1)) |
24330d27 KP |
181 | return FcFalse; |
182 | } | |
183 | return FcTrue; | |
184 | } | |
185 | ||
24330d27 | 186 | static FcBool |
e9be9cd1 KP |
187 | FcListPatternEqual (FcPattern *p1, |
188 | FcPattern *p2, | |
189 | FcObjectSet *os) | |
24330d27 KP |
190 | { |
191 | int i; | |
e9be9cd1 | 192 | FcPatternElt *e1, *e2; |
24330d27 | 193 | |
e9be9cd1 | 194 | for (i = 0; i < os->nobject; i++) |
24330d27 | 195 | { |
4262e0b3 PL |
196 | e1 = FcPatternFindElt (p1, os->objects[i]); |
197 | e2 = FcPatternFindElt (p2, os->objects[i]); | |
e9be9cd1 | 198 | if (!e1 && !e2) |
47d4f950 | 199 | continue; |
e9be9cd1 | 200 | if (!e1 || !e2) |
24330d27 | 201 | return FcFalse; |
e9be9cd1 | 202 | if (!FcListValueListEqual (e1->values, e2->values)) |
24330d27 KP |
203 | return FcFalse; |
204 | } | |
205 | return FcTrue; | |
206 | } | |
207 | ||
e9be9cd1 KP |
208 | /* |
209 | * FcTrue iff all objects in "p" match "font" | |
210 | */ | |
211 | ||
4f27c1c0 KP |
212 | FcBool |
213 | FcListPatternMatchAny (const FcPattern *p, | |
214 | const FcPattern *font) | |
24330d27 KP |
215 | { |
216 | int i; | |
e9be9cd1 | 217 | FcPatternElt *e; |
24330d27 | 218 | |
e9be9cd1 | 219 | for (i = 0; i < p->num; i++) |
24330d27 | 220 | { |
cd2ec1a9 PL |
221 | e = FcPatternFindElt (font, |
222 | FcObjectPtrU((FcPatternEltU(p->elts)+i)->object)); | |
e9be9cd1 | 223 | if (!e) |
24330d27 | 224 | return FcFalse; |
cd2ec1a9 | 225 | if (!FcListValueListMatchAny ((FcPatternEltU(p->elts)+i)->values, /* pat elts */ |
74a623e0 | 226 | e->values)) /* font elts */ |
24330d27 KP |
227 | return FcFalse; |
228 | } | |
229 | return FcTrue; | |
230 | } | |
231 | ||
24330d27 KP |
232 | static FcChar32 |
233 | FcListMatrixHash (const FcMatrix *m) | |
234 | { | |
235 | int xx = (int) (m->xx * 100), | |
236 | xy = (int) (m->xy * 100), | |
237 | yx = (int) (m->yx * 100), | |
238 | yy = (int) (m->yy * 100); | |
239 | ||
240 | return ((FcChar32) xx) ^ ((FcChar32) xy) ^ ((FcChar32) yx) ^ ((FcChar32) yy); | |
241 | } | |
242 | ||
243 | static FcChar32 | |
4262e0b3 | 244 | FcListValueHash (FcValue *value) |
24330d27 | 245 | { |
4262e0b3 | 246 | FcValue v = FcValueCanonicalize(value); |
24330d27 KP |
247 | switch (v.type) { |
248 | case FcTypeVoid: | |
249 | return 0; | |
250 | case FcTypeInteger: | |
251 | return (FcChar32) v.u.i; | |
252 | case FcTypeDouble: | |
253 | return (FcChar32) (int) v.u.d; | |
254 | case FcTypeString: | |
4262e0b3 | 255 | return FcStrHashIgnoreCase (v.u.s); |
24330d27 KP |
256 | case FcTypeBool: |
257 | return (FcChar32) v.u.b; | |
258 | case FcTypeMatrix: | |
4262e0b3 | 259 | return FcListMatrixHash (v.u.m); |
24330d27 | 260 | case FcTypeCharSet: |
4262e0b3 | 261 | return FcCharSetCount (v.u.c); |
88c747e2 | 262 | case FcTypeFTFace: |
d1bec8c6 | 263 | return (long) v.u.f; |
d8d73958 | 264 | case FcTypeLangSet: |
4262e0b3 | 265 | return FcLangSetHash (v.u.l); |
24330d27 KP |
266 | } |
267 | return 0; | |
268 | } | |
269 | ||
270 | static FcChar32 | |
cd2ec1a9 | 271 | FcListValueListHash (FcValueListPtr list) |
24330d27 KP |
272 | { |
273 | FcChar32 h = 0; | |
274 | ||
cd2ec1a9 | 275 | while (FcValueListPtrU(list)) |
24330d27 | 276 | { |
4262e0b3 | 277 | h = h ^ FcListValueHash (&FcValueListPtrU(list)->value); |
cd2ec1a9 | 278 | list = FcValueListPtrU(list)->next; |
24330d27 KP |
279 | } |
280 | return h; | |
281 | } | |
282 | ||
283 | static FcChar32 | |
284 | FcListPatternHash (FcPattern *font, | |
285 | FcObjectSet *os) | |
286 | { | |
287 | int n; | |
288 | FcPatternElt *e; | |
289 | FcChar32 h = 0; | |
290 | ||
291 | for (n = 0; n < os->nobject; n++) | |
292 | { | |
4262e0b3 | 293 | e = FcPatternFindElt (font, os->objects[n]); |
24330d27 KP |
294 | if (e) |
295 | h = h ^ FcListValueListHash (e->values); | |
296 | } | |
297 | return h; | |
298 | } | |
299 | ||
300 | typedef struct _FcListBucket { | |
301 | struct _FcListBucket *next; | |
302 | FcChar32 hash; | |
303 | FcPattern *pattern; | |
304 | } FcListBucket; | |
305 | ||
306 | #define FC_LIST_HASH_SIZE 4099 | |
307 | ||
308 | typedef struct _FcListHashTable { | |
309 | int entries; | |
310 | FcListBucket *buckets[FC_LIST_HASH_SIZE]; | |
311 | } FcListHashTable; | |
312 | ||
313 | static void | |
314 | FcListHashTableInit (FcListHashTable *table) | |
315 | { | |
316 | table->entries = 0; | |
317 | memset (table->buckets, '\0', sizeof (table->buckets)); | |
318 | } | |
319 | ||
320 | static void | |
321 | FcListHashTableCleanup (FcListHashTable *table) | |
322 | { | |
323 | int i; | |
324 | FcListBucket *bucket, *next; | |
325 | ||
326 | for (i = 0; i < FC_LIST_HASH_SIZE; i++) | |
327 | { | |
328 | for (bucket = table->buckets[i]; bucket; bucket = next) | |
329 | { | |
330 | next = bucket->next; | |
331 | FcPatternDestroy (bucket->pattern); | |
332 | FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket)); | |
333 | free (bucket); | |
334 | } | |
335 | table->buckets[i] = 0; | |
336 | } | |
337 | table->entries = 0; | |
338 | } | |
339 | ||
90442681 PL |
340 | static int |
341 | FcGetDefaultObjectLangIndex (FcPattern *font, const char *object) | |
342 | { | |
343 | FcChar8 *lang = FcGetDefaultLang (); | |
344 | FcPatternElt *e = FcPatternFindElt (font, object); | |
345 | FcValueListPtr v; | |
346 | FcValue value; | |
347 | int idx = -1; | |
348 | int i; | |
349 | ||
350 | if (e) | |
351 | { | |
352 | for (v = e->values, i = 0; FcValueListPtrU(v); v = FcValueListPtrU(v)->next, ++i) | |
353 | { | |
354 | value = FcValueCanonicalize (&FcValueListPtrU (v)->value); | |
355 | ||
356 | if (value.type == FcTypeString) | |
357 | { | |
358 | FcLangResult res = FcLangCompare (value.u.s, lang); | |
359 | if (res == FcLangEqual || (res == FcLangDifferentCountry && idx < 0)) | |
360 | idx = i; | |
361 | } | |
362 | } | |
363 | } | |
364 | ||
365 | return (idx > 0) ? idx : 0; | |
366 | } | |
367 | ||
24330d27 KP |
368 | static FcBool |
369 | FcListAppend (FcListHashTable *table, | |
370 | FcPattern *font, | |
371 | FcObjectSet *os) | |
372 | { | |
373 | int o; | |
374 | FcPatternElt *e; | |
cd2ec1a9 | 375 | FcValueListPtr v; |
24330d27 KP |
376 | FcChar32 hash; |
377 | FcListBucket **prev, *bucket; | |
90442681 PL |
378 | int familyidx = -1; |
379 | int fullnameidx = -1; | |
380 | int styleidx = -1; | |
381 | int defidx = 0; | |
382 | int idx; | |
24330d27 KP |
383 | |
384 | hash = FcListPatternHash (font, os); | |
385 | for (prev = &table->buckets[hash % FC_LIST_HASH_SIZE]; | |
386 | (bucket = *prev); prev = &(bucket->next)) | |
387 | { | |
388 | if (bucket->hash == hash && | |
389 | FcListPatternEqual (bucket->pattern, font, os)) | |
390 | return FcTrue; | |
391 | } | |
392 | bucket = (FcListBucket *) malloc (sizeof (FcListBucket)); | |
393 | if (!bucket) | |
394 | goto bail0; | |
395 | FcMemAlloc (FC_MEM_LISTBUCK, sizeof (FcListBucket)); | |
396 | bucket->next = 0; | |
397 | bucket->hash = hash; | |
398 | bucket->pattern = FcPatternCreate (); | |
399 | if (!bucket->pattern) | |
400 | goto bail1; | |
401 | ||
402 | for (o = 0; o < os->nobject; o++) | |
403 | { | |
90442681 PL |
404 | if (!strcmp (os->objects[o], FC_FAMILY) || !strcmp (os->objects[o], FC_FAMILYLANG)) |
405 | { | |
406 | if (familyidx < 0) | |
407 | familyidx = FcGetDefaultObjectLangIndex (font, FC_FAMILYLANG); | |
408 | defidx = familyidx; | |
409 | } | |
410 | else if (!strcmp (os->objects[o], FC_FULLNAME) || !strcmp (os->objects[o], FC_FULLNAMELANG)) | |
411 | { | |
412 | if (fullnameidx < 0) | |
413 | fullnameidx = FcGetDefaultObjectLangIndex (font, FC_FULLNAMELANG); | |
414 | defidx = fullnameidx; | |
415 | } | |
416 | else if (!strcmp (os->objects[o], FC_STYLE) || !strcmp (os->objects[o], FC_STYLELANG)) | |
417 | { | |
418 | if (styleidx < 0) | |
419 | styleidx = FcGetDefaultObjectLangIndex (font, FC_STYLELANG); | |
420 | defidx = styleidx; | |
421 | } | |
422 | else | |
423 | defidx = 0; | |
424 | ||
e77c1718 PL |
425 | /* Also, copy over the full path info. */ |
426 | if (!strcmp (os->objects[o], FC_FILE)) | |
793154ed | 427 | FcPatternTransferFullFname (bucket->pattern, font); |
e77c1718 | 428 | |
4262e0b3 | 429 | e = FcPatternFindElt (font, os->objects[o]); |
24330d27 KP |
430 | if (e) |
431 | { | |
90442681 PL |
432 | for (v = e->values, idx = 0; FcValueListPtrU(v); |
433 | v = FcValueListPtrU(v)->next, ++idx) | |
24330d27 KP |
434 | { |
435 | if (!FcPatternAdd (bucket->pattern, | |
4262e0b3 | 436 | os->objects[o], |
90442681 | 437 | FcValueCanonicalize(&FcValueListPtrU(v)->value), defidx != idx)) |
24330d27 KP |
438 | goto bail2; |
439 | } | |
440 | } | |
441 | } | |
442 | *prev = bucket; | |
443 | ++table->entries; | |
444 | ||
445 | return FcTrue; | |
446 | ||
447 | bail2: | |
448 | FcPatternDestroy (bucket->pattern); | |
449 | bail1: | |
450 | FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket)); | |
451 | free (bucket); | |
452 | bail0: | |
453 | return FcFalse; | |
454 | } | |
455 | ||
456 | FcFontSet * | |
80c053b7 KP |
457 | FcFontSetList (FcConfig *config, |
458 | FcFontSet **sets, | |
459 | int nsets, | |
460 | FcPattern *p, | |
461 | FcObjectSet *os) | |
24330d27 KP |
462 | { |
463 | FcFontSet *ret; | |
464 | FcFontSet *s; | |
465 | int f; | |
80c053b7 | 466 | int set; |
24330d27 KP |
467 | FcListHashTable table; |
468 | int i; | |
469 | FcListBucket *bucket; | |
470 | ||
471 | if (!config) | |
472 | { | |
179c3995 KP |
473 | if (!FcInitBringUptoDate ()) |
474 | goto bail0; | |
475 | ||
24330d27 KP |
476 | config = FcConfigGetCurrent (); |
477 | if (!config) | |
478 | goto bail0; | |
479 | } | |
480 | FcListHashTableInit (&table); | |
481 | /* | |
482 | * Walk all available fonts adding those that | |
483 | * match to the hash table | |
484 | */ | |
80c053b7 | 485 | for (set = 0; set < nsets; set++) |
24330d27 | 486 | { |
80c053b7 | 487 | s = sets[set]; |
24330d27 KP |
488 | if (!s) |
489 | continue; | |
490 | for (f = 0; f < s->nfont; f++) | |
74a623e0 KP |
491 | if (FcListPatternMatchAny (p, /* pattern */ |
492 | s->fonts[f])) /* font */ | |
24330d27 KP |
493 | if (!FcListAppend (&table, s->fonts[f], os)) |
494 | goto bail1; | |
495 | } | |
496 | #if 0 | |
497 | { | |
498 | int max = 0; | |
499 | int full = 0; | |
500 | int ents = 0; | |
501 | int len; | |
502 | for (i = 0; i < FC_LIST_HASH_SIZE; i++) | |
503 | { | |
504 | if ((bucket = table.buckets[i])) | |
505 | { | |
506 | len = 0; | |
507 | for (; bucket; bucket = bucket->next) | |
508 | { | |
509 | ents++; | |
510 | len++; | |
511 | } | |
512 | if (len > max) | |
513 | max = len; | |
514 | full++; | |
515 | } | |
516 | } | |
517 | printf ("used: %d max: %d avg: %g\n", full, max, | |
518 | (double) ents / FC_LIST_HASH_SIZE); | |
519 | } | |
520 | #endif | |
521 | /* | |
522 | * Walk the hash table and build | |
523 | * a font set | |
524 | */ | |
525 | ret = FcFontSetCreate (); | |
526 | if (!ret) | |
527 | goto bail0; | |
528 | for (i = 0; i < FC_LIST_HASH_SIZE; i++) | |
529 | while ((bucket = table.buckets[i])) | |
530 | { | |
531 | if (!FcFontSetAdd (ret, bucket->pattern)) | |
532 | goto bail2; | |
533 | table.buckets[i] = bucket->next; | |
534 | FcMemFree (FC_MEM_LISTBUCK, sizeof (FcListBucket)); | |
535 | free (bucket); | |
536 | } | |
537 | ||
538 | return ret; | |
539 | ||
540 | bail2: | |
541 | FcFontSetDestroy (ret); | |
542 | bail1: | |
543 | FcListHashTableCleanup (&table); | |
544 | bail0: | |
545 | return 0; | |
546 | } | |
80c053b7 KP |
547 | |
548 | FcFontSet * | |
549 | FcFontList (FcConfig *config, | |
550 | FcPattern *p, | |
551 | FcObjectSet *os) | |
552 | { | |
553 | FcFontSet *sets[2]; | |
554 | int nsets; | |
555 | ||
556 | if (!config) | |
557 | { | |
558 | config = FcConfigGetCurrent (); | |
559 | if (!config) | |
560 | return 0; | |
561 | } | |
562 | nsets = 0; | |
563 | if (config->fonts[FcSetSystem]) | |
564 | sets[nsets++] = config->fonts[FcSetSystem]; | |
565 | if (config->fonts[FcSetApplication]) | |
566 | sets[nsets++] = config->fonts[FcSetApplication]; | |
567 | return FcFontSetList (config, sets, nsets, p, os); | |
568 | } |