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