6 if (!FcInit()) assert(0, "cannot init fontconfig");
7 //scope(exit) FcFini(); // that segfaults, lol. packard, please, kill yourself.
8 //FcPattern* pat = FcNameParse("Arial:pixelsize=16");
9 //FcPattern* pat = FcNameParse("Arial"); // works too
10 //FcPattern* pat = FcNameParse("/usr/share/fonts/TTF/arial.ttf"); // returns substitute
11 //FcPattern* pat = FcNameParse("Arial:bold");
12 //FcPattern* pat = FcNameParse("Arial:italic");
13 //FcPattern* pat = FcNameParse("Arial:italic:bold");
14 //FcPattern* pat = FcNameParse("Arial:bold:italic");
15 FcPattern
* pat
= FcNameParse("Courier New:bold:italic");
16 if (pat
is null) assert(0, "cannot parse font name");
17 if (!FcConfigSubstitute(null, pat
, FcMatchPattern
)) assert(0, "cannot find fontconfig substitute");
18 FcDefaultSubstitute(pat
);
21 FcPattern
* font
= FcFontMatch(null, pat
, &result
);
24 if (FcPatternGetString(font
, FC_FILE
, 0, &file
) == FcResultMatch
) {
25 //import std.string : fromStringz;
26 conwriteln("font file: [", file
, "]");
29 if (FcPatternGetDouble(font
, FC_PIXEL_SIZE
, 0, &pixelsize
) == FcResultMatch
) {
30 conwriteln("pixel size: ", pixelsize
);
33 if (FcPatternGetDouble(font
, FC_SIZE
, 0, &pointsize
) == FcResultMatch
) {
34 conwriteln("point size: ", pointsize
);
37 FcPatternDestroy(pat
);