6 if (!FcInit()) assert(0, "cannot init fontconfig");
7 //scope(exit) FcFini(); // that segfaults, lol. packard, please, kill yourself.
9 FcConfig
* config
= FcInitLoadConfigAndFonts();
10 FcPattern
* pat
= FcPatternCreate();
11 FcObjectSet
* os
= FcObjectSetBuild(FC_FAMILY
.ptr
, FC_STYLE
.ptr
, FC_LANG
.ptr
, FC_FILE
.ptr
, null);
12 FcFontSet
* fs
= FcFontList(config
, pat
, os
);
14 conwriteln("Total matching fonts: ", fs
.nfont
);
15 foreach (int i
; 0..fs
.nfont
) {
16 FcPattern
* font
= fs
.fonts
[i
];
17 char* file
, style
, family
;
18 if (FcPatternGetString(font
, FC_FILE
, 0, &file
) == FcResultMatch
&&
19 FcPatternGetString(font
, FC_FAMILY
, 0, &family
) == FcResultMatch
&&
20 FcPatternGetString(font
, FC_STYLE
, 0, &style
) == FcResultMatch
)
22 conwriteln("family: <", family
, ">; style: ", style
, "); file: ", file
);