/* compile with: gcc sample.c -o sample `pkg-config --libs --cflags fontconfig` */ #include #include int main (int argc, const char * argv[]) { FcPattern *p1, *p2; FcChar8 *fc_file1; FcChar8 *fc_file2; FcResult res; p1 = FcPatternBuild (NULL, FC_FAMILY, FcTypeString, "Sans", FC_STYLE, FcTypeString, "Italic", NULL); p2 = FcPatternBuild (NULL, FC_FAMILY, FcTypeString, "Sans", FC_SLANT, FcTypeInteger, FC_SLANT_ITALIC, NULL); FcConfigSubstitute (NULL, p1, FcMatchPattern); FcDefaultSubstitute (p1); p1 = FcFontMatch (NULL, p1, &res); FcPatternGetString (p1, FC_FILE, 0, &fc_file1); printf ("1: "); printf (fc_file1); printf ("\n"); FcConfigSubstitute (NULL, p2, FcMatchPattern); FcDefaultSubstitute (p2); p1 = FcFontMatch (NULL, p2, &res); FcPatternGetString (p1, FC_FILE, 0, &fc_file2); printf ("2: "); printf (fc_file2); printf ("\n"); }