3 #include <X11/Xft/Xft.h>
10 const char *NAME = "xftlsfonts";
11 const char *VERSION = "1.0";
17 int main(int argc, char **argv) {
19 for (int i = 1; i < argc; ++i)
20 if (string(argv[i]) == "-help" ||
21 string(argv[i]) == "--help" ||
22 string(argv[i]) == "-version" ||
23 string(argv[i]) == "--version") {
24 cout << NAME << " version " << VERSION << endl;
25 cout << "Copyright (c) 2002, Ben Jansens <ben@orodu.net>" << endl;
31 Display *display = XOpenDisplay(NULL);
33 XftFontSet *set = XftListFonts(display, DefaultScreen(display),
36 cout << "Found " << set->nfont << " fonts:" << endl;
38 for (int i = 0; i < set->nfont; ++i) {
39 for (int e = 0; e < set->fonts[i]->num; ++e) {
40 // if (string(set->fonts[i]->elts[e].object) != "family")
41 // continue; // i just want font family names
44 cout << " "; // indent after the first element
45 cout << set->fonts[i]->elts[e].object << ": ";
47 XftValueList *vallist = set->fonts[i]->elts[e].values;
55 XftValue val = vallist->value;
78 cout << "xx(" << val.u.m->xx << ") ";
79 cout << "xy(" << val.u.m->xy << ") ";
80 cout << "yx(" << val.u.m->yx << ") ";
81 cout << "yy(" << val.u.m->yy << ")";
84 } while ((vallist = vallist->next));
91 XCloseDisplay(display);